Package com.google.gwt.dev.js.ast

Examples of com.google.gwt.dev.js.ast.JsArrayLiteral


      stack.push(newExpression);
    }

    @Override
    public void endVisit(JsArrayLiteral x, JsContext<JsExpression> ctx) {
      JsArrayLiteral toReturn = new JsArrayLiteral(x.getSourceInfo());
      List<JsExpression> expressions = toReturn.getExpressions();
      int size = x.getExpressions().size();
      while (size-- > 0) {
        expressions.add(0, stack.pop());
      }
      stack.push(toReturn);
View Full Code Here


            + tokenType);
    }
  }

  private JsArrayLiteral mapArrayLit(Node node) throws JsParserException {
    JsArrayLiteral toLit = new JsArrayLiteral(makeSourceInfo(node));
    Node from = node.getFirstChild();
    while (from != null) {
      toLit.getExpressions().add(mapExpression(from));
      from = from.getNext();
    }
    return toLit;
  }
View Full Code Here

  private void makeVars() {
    SourceInfo info = program.getSourceInfo().makeChild(JsStackEmulator.class,
        "Emulated stack data");
    JsVar stackVar = new JsVar(info, stack);
    stackVar.setInitExpr(new JsArrayLiteral(info));
    JsVar stackDepthVar = new JsVar(info, stackDepth);
    stackDepthVar.setInitExpr(program.getNumberLiteral(info, -1));
    JsVar lineNumbersVar = new JsVar(info, lineNumbers);
    lineNumbersVar.setInitExpr(new JsArrayLiteral(info));

    JsVars vars;
    JsStatement first = program.getGlobalBlock().getStatements().get(0);
    if (first instanceof JsVars) {
      vars = (JsVars) first;
View Full Code Here

      push(nameRef);
    }

    @Override
    public void endVisit(JsonArray x, Context ctx) {
      JsArrayLiteral jsArrayLiteral = new JsArrayLiteral(x.getSourceInfo());
      popList(jsArrayLiteral.getExpressions(), x.exprs.size());
      push(jsArrayLiteral);
    }
View Full Code Here

      globalStmts.add(stmt);
      typeForStatMap.put(stmt, program.getTypeJavaLangObject());
    }

    private JsExpression generateTypeTable() {
      JsArrayLiteral arrayLit = new JsArrayLiteral(
          jsProgram.createSourceInfoSynthetic(GenerateJavaScriptAST.class,
              "Type table"));
      for (int i = 0; i < program.getJsonTypeTable().size(); ++i) {
        JsonObject jsonObject = program.getJsonTypeTable().get(i);
        accept(jsonObject);
        arrayLit.getExpressions().add((JsExpression) pop());
      }
      return arrayLit;
    }
View Full Code Here

    push(program.getNumberLiteral(x.getSourceInfo(), x.getValue()));
  }

  @Override
  public void endVisit(JLongLiteral x, Context ctx) {
    JsArrayLiteral arrayLit = new JsArrayLiteral(x.getSourceInfo());
    double[] doubleArray = LongLib.typeChange(x.getValue());
    arrayLit.getExpressions().add(
        program.getNumberLiteral(x.getSourceInfo(), doubleArray[0]));
    arrayLit.getExpressions().add(
        program.getNumberLiteral(x.getSourceInfo(), doubleArray[1]));
    push(arrayLit);
  }
View Full Code Here

      currentMethod = null;
    }

    // @Override
    public void endVisit(JsonArray x, Context ctx) {
      JsArrayLiteral jsArrayLiteral = new JsArrayLiteral();
      popList(jsArrayLiteral.getExpressions(), x.exprs.size());
      push(jsArrayLiteral);
    }
View Full Code Here

    }

    private void generateTypeTable(JsVars vars) {
      JField typeIdArray = program.getSpecialField("Cast.typeIdArray");
      JsName jsName = getName(typeIdArray);
      JsArrayLiteral arrayLit = new JsArrayLiteral();
      for (int i = 0; i < program.getJsonTypeTable().size(); ++i) {
        JsonObject jsonObject = (JsonObject) program.getJsonTypeTable().get(i);
        accept(jsonObject);
        arrayLit.getExpressions().add((JsExpression) pop());
      }
      JsVar var = new JsVar(jsName);
      var.setInitExpr(arrayLit);
      vars.add(var);
    }
View Full Code Here

      JsNameRef name = (JsNameRef) expr;
      if (!name.getIdent().equals("concat")) {
        return super.visit(invoke, ctx);
      }

      JsArrayLiteral headElements = (JsArrayLiteral) name.getQualifier();

      for (JsExpression ex : invoke.getArguments()) {
        JsArrayLiteral arg = (JsArrayLiteral) ex;
        headElements.getExpressions().addAll(arg.getExpressions());
      }

      ctx.replaceMe(headElements);
      return true;
    }
View Full Code Here

    }

    @Override
    public void endVisit(JsCastMap x, Context ctx) {
      super.endVisit(x, ctx);
      JsArrayLiteral arrayLit = (JsArrayLiteral) pop();
      SourceInfo sourceInfo = x.getSourceInfo();
      if (namesByQueryId == null || x.getExprs().size() == 0) {
        String stringMap = castMapToString(x);
        // if interned, use variable reference
        if (namesByCastMap.containsKey(stringMap)) {
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.js.ast.JsArrayLiteral

Copyright © 2018 www.massapicom. 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.