Examples of JLiteral


Examples of com.google.gwt.dev.jjs.ast.JLiteral

    private void processDim(JNewArray x, Context ctx, JArrayType arrayType) {
      // override the type of the called method with the array's type
      JMethodCall call = new JMethodCall(x.getSourceInfo(), null, initDim,
          arrayType);
      JLiteral classLit = x.getClassLiteral();
      JLiteral typeIdLit = program.getLiteralInt(program.getTypeId(arrayType));
      JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(arrayType));
      JExpression dim = x.dims.get(0);
      JType elementType = arrayType.getElementType();
      call.addArgs(classLit, typeIdLit, queryIdLit, dim,
          getSeedTypeLiteralFor(elementType));
      ctx.replaceMe(call);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

      JType cur = arrayType;
      for (int i = 0; i < dims; ++i) {
        // Walk down each type from most dims to least.
        JArrayType curArrayType = (JArrayType) cur;

        JLiteral classLit = x.getClassLiterals().get(i);
        classLitList.exprs.add(classLit);

        JLiteral typeIdLit = program.getLiteralInt(program.getTypeId(curArrayType));
        typeIdList.exprs.add(typeIdLit);

        JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(curArrayType));
        queryIdList.exprs.add(queryIdLit);

        dimList.exprs.add(x.dims.get(i));
        cur = curArrayType.getElementType();
      }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

        JArrayType arrayType) {
      // override the type of the called method with the array's type
      SourceInfo sourceInfo = x.getSourceInfo().makeChild(ArrayVisitor.class,
          "Array initializer");
      JMethodCall call = new JMethodCall(sourceInfo, null, initValues, arrayType);
      JLiteral classLit = x.getClassLiteral();
      JLiteral typeIdLit = program.getLiteralInt(program.getTypeId(arrayType));
      JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(arrayType));
      JsonArray initList = new JsonArray(sourceInfo, program.getJavaScriptObject());
      for (int i = 0; i < x.initializers.size(); ++i) {
        initList.exprs.add(x.initializers.get(i));
      }
      call.addArgs(classLit, typeIdLit, queryIdLit, initList);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

    }

    // @Override
    public void endVisit(JNewArray x, Context ctx) {
      JArrayType type = x.getArrayType();
      JLiteral litTypeName = program.getLiteralString(calcClassName(type));

      if (x.initializers != null) {
        processInitializers(x, ctx, type, litTypeName);
      } else {
        processDims(x, ctx, type, litTypeName);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

         *
         * new int[2][3][4]->int
         *
         */
        JArrayType cur = program.getTypeArray(leafType, outstandingDims--);
        JLiteral typeIdLit = program.getLiteralInt(program.getTypeId(cur));
        typeIdList.exprs.add(typeIdLit);
        JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(cur));
        queryIdList.exprs.add(queryIdLit);
        dimList.exprs.add(dim);
      }
      JType targetType = leafType;
      if (outstandingDims > 0) {
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

    private void processInitializers(JNewArray x, Context ctx,
        JArrayType arrayType, JLiteral litTypeName) {
      // override the type of the called method with the array's type
      JMethodCall call = new JMethodCall(program, x.getSourceInfo(), null,
          initValues, arrayType);
      JLiteral typeIdLit = program.getLiteralInt(program.getTypeId(arrayType));
      JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(arrayType));
      JsonArray initList = new JsonArray(program);
      for (int i = 0; i < x.initializers.size(); ++i) {
        initList.exprs.add(x.initializers.get(i));
      }
      call.getArgs().add(litTypeName);
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

      }
    }

    @Override
    public void endVisit(JFieldRef x, Context ctx) {
      JLiteral literal = tryGetConstant(x);
      if (literal == null && !ignoringExpressionOutput.contains(x)) {
        return;
      }
      /*
       * At this point, either we have a constant replacement, or our value is
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

      }
    }

    @Override
    public void endVisit(JLocalRef x, Context ctx) {
      JLiteral literal = tryGetConstant(x);
      if (literal != null) {
        assert (!x.hasSideEffects());
        ctx.replaceMe(literal);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

      }
    }

    @Override
    public void endVisit(JParameterRef x, Context ctx) {
      JLiteral literal = tryGetConstant(x);
      if (literal != null) {
        assert (!x.hasSideEffects());
        ctx.replaceMe(literal);
      }
    }
View Full Code Here

Examples of com.google.gwt.dev.jjs.ast.JLiteral

      }
    }

    private JLiteral tryGetConstant(JVariableRef x) {
      if (!lvalues.contains(x)) {
        JLiteral lit = x.getTarget().getConstInitializer();
        if (lit != null) {
          /*
           * Upcast the initializer so that the semantics of any arithmetic on
           * this value is not changed.
           */
 
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.