Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.Operation.children()


        case SQUARE_BRACKET:
          return sideEffectingReadAssignOperand(
              op.children().get(0), op.children().get(1), scope);
        case MEMBER_ACCESS:
          return sideEffectingReadAssignOperand(
              op.children().get(0), toStringLiteral(op.children().get(1)),
              scope);
        default: break;
      }
    }
    throw new IllegalArgumentException("Not an lvalue : " + operand);
View Full Code Here


    if (grandparent.node instanceof Operation) {
      // Handles ++ac, ac += ..., ac = ...
      Operation op = grandparent.cast(Operation.class).node;
      Operator operator = op.getOperator();
      return (operator.getCategory() == OperatorCategory.ASSIGNMENT
              && ac.parent.node == op.children().get(0)) ? operator : null;
    } else if (grandparent.node instanceof ExpressionStmt
               && grandparent.parent != null
               && grandparent.parent.node instanceof ForEachLoop) {
      // Handle
      //    for (k in obj) { ... }
View Full Code Here

    tests.acceptPostOrder(new Visitor() {
      @Override
      public boolean visit(AncestorChain<?> chain) {
        if (Operation.is(chain.node, Operator.ADDITION)) {
          Operation op = chain.cast(Operation.class).node;
          Expression left = op.children().get(0);
          Expression right = op.children().get(1);
          if (left instanceof StringLiteral && right instanceof StringLiteral) {
            StringLiteral concatenation = StringLiteral.valueOf(
                FilePosition.span(
                    left.getFilePosition(), right.getFilePosition()),
View Full Code Here

      @Override
      public boolean visit(AncestorChain<?> chain) {
        if (Operation.is(chain.node, Operator.ADDITION)) {
          Operation op = chain.cast(Operation.class).node;
          Expression left = op.children().get(0);
          Expression right = op.children().get(1);
          if (left instanceof StringLiteral && right instanceof StringLiteral) {
            StringLiteral concatenation = StringLiteral.valueOf(
                FilePosition.span(
                    left.getFilePosition(), right.getFilePosition()),
                ((StringLiteral) left).getUnquotedValue()
View Full Code Here

    is = new InputSource(new URI("http://example.org/test"));

    // Extract the JSON style-object from the call.
    assertTrue(render(tests), Operation.is(tests, Operator.FUNCTION_CALL));
    Operation call = (Operation) tests;
    assertEquals(2, call.children().size());
    Expression testArray = call.children().get(1);
    // testArray is an array like
    // [{ test_name: ..., tests: [] }]
    for (Expression test : ((ArrayConstructor) testArray).children()) {
      ObjectConstructor obj = (ObjectConstructor) test;
View Full Code Here

    // Extract the JSON style-object from the call.
    assertTrue(render(tests), Operation.is(tests, Operator.FUNCTION_CALL));
    Operation call = (Operation) tests;
    assertEquals(2, call.children().size());
    Expression testArray = call.children().get(1);
    // testArray is an array like
    // [{ test_name: ..., tests: [] }]
    for (Expression test : ((ArrayConstructor) testArray).children()) {
      ObjectConstructor obj = (ObjectConstructor) test;
      String name = (String)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.