Examples of IntegerLiteral


Examples of com.google.caja.parser.js.IntegerLiteral

          }
        }
        for (int i = 0; i < toAdd.length; ++i) {
          p.appendChild(new ExpressionStmt(
              FilePosition.UNKNOWN,
              new IntegerLiteral(FilePosition.UNKNOWN, toAdd[i])));
        }
      }
      return true;
    }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

    for (U e : entries) {
      // Since enum values are public, we don't want Closure compiler
      // to rewrite them, so we need quoted keys.
      String quoted = StringLiteral.toQuotedValue(keyMaker.apply(e));
      keys.add(new StringLiteral(unk, quoted));
      values.add(new IntegerLiteral(unk, valueMaker.apply(e)));
    }
    return export(key, (Expression) QuasiBuilder.substV(
        "({ @k*: @v* })",
        "i", new Reference(new Identifier(unk, key)),
        "k", new ParseTreeNodeContainer(keys),
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

        if (ElKey.HTML_WILDCARD.equals(key.el)
            || schema.isElementAllowed(key.el)
            // Whitelisted to allow dynamic script loading via proxy
            || SCRIPT_SRC.equals(key)) {
          keys.add(StringLiteral.valueOf(unk, key.toString()));
          values.add(new IntegerLiteral(unk, A_TYPE_MAP.get(e.getValue())));
        }
      }
      definitions.appendChild(export("ATTRIBS",
          (Expression) QuasiBuilder.substV(
              "({ @k*: @v* })",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(EFlag.class),
        "eflags",
        new Function<EFlag, String>() {
          public String apply(EFlag f) {
            return f.name();
          }
        },
        new Function<EFlag, Integer>() {
          public Integer apply(EFlag f) {
            return f.bitMask;
          }
        })
    );

    definitions.appendChild(mapFromMap(
        eflags,
        "ELEMENTS",
        new Function<EnumSet<EFlag>, Expression>() {
          public Expression apply(EnumSet<EFlag> flags) {
            int value = 0;
            for (EFlag f : flags) { value |= f.bitMask; }
            return new IntegerLiteral(unk, value);
          }
        })
    );

    definitions.appendChild(mapFromMap(
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

      for (CssPropBit b : data.properties) {
        propBits |= b.jsValue;
      }

      dataObj.appendChild(
          new ValueProperty(propbitsObjKey, new IntegerLiteral(unk, propBits)));

      List<Expression> litGroups = Lists.newArrayList();
      for (int groupIndex : litPartition.unions[propIndex]) {
        litGroups.add((Expression) QuasiBuilder.substV(
            "L[@i]", "i", new IntegerLiteral(unk, groupIndex)));
      }
      if (!litGroups.isEmpty()) {
        dataObj.appendChild(new ValueProperty(
            litgroupObjKey, new ArrayConstructor(unk, litGroups)));
      }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

    Number n = rl.getValue();
    double dv = n.doubleValue();
    long lv = n.longValue();
    // Convert 1.0 to 1, but do not convert -0.0 to 0.
    if (dv == lv && (dv != 0d || (1 / dv) > 0)) {
      return new IntegerLiteral(rl.getFilePosition(), lv);
    }
    return rl;
  }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

    List<? extends ParseTreeNode> children = returnThrowOrExprStmt.children();
    assert children.size() < 2;
    if (children.isEmpty()) {
      FilePosition pos = FilePosition.endOf(
          returnThrowOrExprStmt.getFilePosition());
      return Operation.create(pos, Operator.VOID, new IntegerLiteral(pos, 0));
    }
    return (Expression) children.get(0);
  }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

  private static boolean isExpressionListTerminator(ParseTreeNode s) {
    return s instanceof ReturnStmt || s instanceof ThrowStmt;
  }

  private static Expression undef(FilePosition pos) {
    return Operation.create(pos, Operator.VOID, new IntegerLiteral(pos, 0));
  }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

        AncestorChain<Reference> toReplace = read.parent.cast(Reference.class);
        Expression repl;
        if (value == null) {
          FilePosition fp = toReplace.node.getFilePosition();
          repl = Operation.create(fp, Operator.VOID, new IntegerLiteral(fp, 0));
        } else {
          repl = (Expression) value.clone();
        }
        toReplace.parent.cast(MutableParseTreeNode.class)
            .node.replaceChild(repl, toReplace.node);
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

    }
    List<ParseTreeNode> vals = new ArrayList<ParseTreeNode>();
    for (int i = 0; i < m.getParameters().length - 1; i++) {
      vals.add(QuasiBuilder.substV(""
          + "args[@idx];",
          "idx", new IntegerLiteral(FilePosition.UNKNOWN, i)));
    }
    vals.add(QuasiBuilder.substV(""
        + "Array.prototype.slice.call(args, @idx, args.length);",
        "idx", new IntegerLiteral(
            FilePosition.UNKNOWN, m.getParameters().length - 1)));
    return QuasiBuilder.substV(""
        + "function(args) { return [ @vals* ]; }",
        "vals", new ParseTreeNodeContainer(vals));
  }
View Full Code Here

Examples of com.google.caja.parser.js.IntegerLiteral

    List<ParseTreeNode> unwraps = new ArrayList<ParseTreeNode>();
    for (int i = 0; i < m.getParameters().length; i++) {
      unwraps.add(QuasiBuilder.substV(""
          + "@taming.getBean(frame, args[@idx]);",
          "taming", getTamingObject(m.getParameters()[i].getType()),
          "idx", new IntegerLiteral(FilePosition.UNKNOWN, i)));
    }
    return QuasiBuilder.substV(""
        + "function (frame, args) {"
        + "  @arityCheck;"
        + "  args = @varArgsDestructuring(args);"
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.