Examples of ArrayLiteral


Examples of org.dtk.analysis.script.node.ArrayLiteral

    assertEquals(Arrays.asList(0.0, 1.0), lit.getValueList());       
  }
 
  @Test
  public void detectsArrayValuesInArrayLiteral() throws InvalidLiteralNode
    ArrayLiteral lit = getLiteralNode("[[]]");   
    List<Object> values = lit.getValueList();   
    assertTrue(1 == values.size());   
    Object arrayLit = values.get(0)
    assertTrue(arrayLit instanceof ArrayLiteral);   
    assertEquals(Collections.EMPTY_LIST, ((ArrayLiteral) arrayLit).getValueList());
 
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    assertEquals(Collections.EMPTY_LIST, ((ArrayLiteral) arrayLit).getValueList());
 
 
  @Test
  public void detectsInnerObjLiteralValuesInArrayLiteral() throws InvalidLiteralNode
    ArrayLiteral lit = getLiteralNode("[{ num: 1, str: 'str', b: true }]");           
   
    List<Object> values = lit.getValueList();   
    assertTrue(1 == values.size());   
    Object innerLit = values.get(0)
    assertTrue(innerLit instanceof ObjectLiteral);   
   
    assertValues((ObjectLiteral) innerLit, getPrepopulatedMap("num", 1.0, "str", "str", "b", true));
View Full Code Here

Examples of org.jboss.errai.codegen.literal.ArrayLiteral

          classStructureBuilder.privateField(fieldName, literalValue.getType())
              .modifiers(Modifier.Final).initializesWith(new Statement() {
            @Override
            public String generate(final Context context) {
              return new ArrayLiteral(literalValue.getValue()).getCanonicalString(context);
            }

            @Override
            public MetaClass getType() {
              return literalValue.getType();
View Full Code Here

Examples of org.jboss.errai.codegen.literal.ArrayLiteral

      classStructureBuilder.privateField(fieldName, literalValue.getType())
          .modifiers(Modifier.Final).initializesWith(new Statement() {
        @Override
        public String generate(final Context context) {
          return new ArrayLiteral(literalValue.getValue()).getCanonicalString(context);
        }

        @Override
        public MetaClass getType() {
          return literalValue.getType();
View Full Code Here

Examples of org.jboss.errai.codegen.literal.ArrayLiteral

          classStructureBuilder.privateField(fieldName, literalValue.getType())
              .modifiers(Modifier.Final).initializesWith(new Statement() {
            @Override
            public String generate(final Context context) {
              return new ArrayLiteral(literalValue.getValue()).getCanonicalString(context);
            }

            @Override
            public MetaClass getType() {
              return literalValue.getType();
View Full Code Here

Examples of org.jboss.errai.codegen.literal.ArrayLiteral

          classStructureBuilder.privateField(fieldName, literalValue.getType())
              .modifiers(Modifier.Final).initializesWith(new Statement() {
            @Override
            public String generate(final Context context) {
              return new ArrayLiteral(literalValue.getValue()).getCanonicalString(context);
            }

            @Override
            public MetaClass getType() {
              return literalValue.getType();
View Full Code Here

Examples of org.jboss.errai.codegen.literal.ArrayLiteral

          classStructureBuilder.privateField(fieldName, literalValue.getType())
              .modifiers(Modifier.Final).initializesWith(new Statement() {
            @Override
            public String generate(Context context) {
              final ArrayLiteral arrayLiteral = new ArrayLiteral(literalValue.getValue());
              return arrayLiteral.getCanonicalString(context);
            }

            @Override
            public MetaClass getType() {
              return literalValue.getType();
View Full Code Here

Examples of org.jpox.store.mapped.expression.ArrayLiteral

    {
        if (containerIsStoredInSingleColumn())
        {
            throw new JPOXUserException(LOCALISER.msg("041026", fmd.getFullFieldName())).setFatal();
        }
        return new ArrayLiteral(qs, this, value);
    }
View Full Code Here

Examples of org.lilystudio.javascript.expression.ArrayLiteral

    case Token.REGEXP:
      return new RegexpLiteral(node, root, scope);

    case Token.ARRAYLIT:
      return new ArrayLiteral(node, root, scope);

    case Token.OBJECTLIT:
      return new ObjectLiteral(node, root, scope);

    case Token.GETPROP:
    case Token.GETELEM:
      return new MemberExpression(node, root, scope);

    case Token.CALL:
    case Token.NEW: {
      Node firstChild = node.getFirstChild();
      if (firstChild.getType() == Token.NAME) {
        String target = firstChild.getString();
        Node next = firstChild.getNext();
        if (target.equals("Object")) {
          // Object类不需要使用new
          node.setType(Token.CALL);
          if (next == null) {
            return new ObjectLiteral(node.getLineno());
          }
        } else if (target.equals("Array")) {
          // Array类可以使用[]代替
          node.setType(Token.CALL);
          if (next == null
              || (next.getType() == Token.NUMBER && next.getDouble() == 0)
              || next.getNext() != null) {
            if (next != null && next.getType() == Token.NUMBER
                && next.getDouble() == 0) {
              node.removeChild(next);
            }
            node.removeChild(firstChild);
            return new ArrayLiteral(node, root, scope);
          }
        }
      }
      return new CallExpression(node, root, scope);
    }
View Full Code Here

Examples of org.mozilla.javascript.ast.ArrayLiteral

     */
    private List<String> arrayStringLiteral(final AstNode node) {
      checkState(node instanceof ArrayLiteral, node, "Expected array literal only");
      List<String> result = Lists.newArrayList();
      //noinspection ConstantConditions
      ArrayLiteral array = (ArrayLiteral) node;
      for (AstNode element : array.getElements()) {
        result.add(stringLiteral(element));
      }
      return result;
    }
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.