Examples of JLiteral


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

         * We must replace any compile-time constants with the constant value of
         * the field.
         */
        if (field.isCompileTimeConstant()) {
          assert !ctx.isLvalue();
          JLiteral initializer = field.getConstInitializer();
          JType type = initializer.getType();
          if (type instanceof JPrimitiveType || program.isJavaLangString(type)) {
            GenerateJavaScriptLiterals generator = new GenerateJavaScriptLiterals();
            generator.accept(initializer);
            JsExpression result = generator.peek();
            assert (result != null);
View Full Code Here

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

    @Override
    public void endVisit(CaseStatement x, BlockScope scope) {
      try {
        SourceInfo info = makeSourceInfo(x);
        JExpression constantExpression = pop(x.constantExpression);
        JLiteral caseLiteral;
        if (constantExpression == null) {
          caseLiteral = null;
        } else if (constantExpression instanceof JLiteral) {
          caseLiteral = (JLiteral) constantExpression;
        } else {
View Full Code Here

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();
      JsonObject castableTypeMap = program.getCastableTypeMap(arrayType);
      JLiteral queryIdLit = program.getLiteralInt(tryGetQueryId(arrayType));
      JExpression dim = x.dims.get(0);
      JType elementType = arrayType.getElementType();
      call.addArgs(classLit, castableTypeMap, 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);
       
        JsonObject castableTypeMap = program.getCastableTypeMap(curArrayType);
        castableTypeMapList.exprs.add(castableTypeMap);

        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();
      JMethodCall call = new JMethodCall(sourceInfo, null, initValues,
          arrayType);
      JLiteral classLit = x.getClassLiteral();
      JsonObject castableTypeMap = program.getCastableTypeMap(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));
      }
View Full Code Here

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

         * We must replace any compile-time constants with the constant value of
         * the field.
         */
        if (field.isCompileTimeConstant()) {
          assert !ctx.isLvalue();
          JLiteral initializer = field.getConstInitializer();
          JType type = initializer.getType();
          if (type instanceof JPrimitiveType || initializer instanceof JStringLiteral) {
            GenerateJavaScriptLiterals generator = new GenerateJavaScriptLiterals();
            generator.accept(initializer);
            JsExpression result = generator.peek();
            assert (result != null);
View Full Code Here

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

       * supertype, if there is one. Arrays are excluded because they always
       * have Object as their superclass.
       */
      JClassType classType = (JClassType) type;

      JLiteral superclassLiteral;
      if (classType.getSuperClass() != null) {
        if (JProgram.isJsTypePrototype(classType)) {
          JDeclaredType jsInterface = program.typeOracle.getNearestJsType(classType, true);
          assert jsInterface != null;
          superclassLiteral = createDependentClassLiteral(info, jsInterface);
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
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.