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

Examples of com.google.gwt.dev.jjs.ast.js.JsonObject


    public void computeTypeIds() {

      // the 0th entry is the "always false" entry
      classes.add(null);
      jsonObjects.add(new JsonObject(program));

      /*
       * Do String first to reserve typeIds 1 and 2 for Object and String,
       * respectively. This ensures consistent modification of String's
       * prototype.
 
View Full Code Here


          yesArray[boxedInt.intValue()] = yesType;
        }
      }

      // create a sparse lookup object
      JsonObject jsonObject = new JsonObject(program);
      for (int i = 0; i < nextQueryId; ++i) {
        if (yesArray[i] != null) {
          JIntLiteral labelExpr = program.getLiteralInt(i);
          JIntLiteral valueExpr = program.getLiteralInt(1);
          jsonObject.propInits.add(new JsonPropInit(program, labelExpr,
View Full Code Here

        // Was pruned; this compilation must not use GWT.getTypeName().
        return;
      }
      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(typeIdArrayName);
      var.setInitExpr(arrayLit);
View Full Code Here

    }

    private JField createEnumValueMap(JEnumType type) {
      SourceInfo sourceInfo = type.getSourceInfo().makeChild(
          JavaASTGenerationVisitor.class, "enum value lookup map");
      JsonObject map = new JsonObject(sourceInfo, program.getJavaScriptObject());
      for (JEnumField field : type.getEnumList()) {
        // JSON maps require leading underscores to prevent collisions.
        JStringLiteral key = program.getLiteralString(field.getSourceInfo(),
            "_" + field.getName());
        JFieldRef value = new JFieldRef(sourceInfo, null, field, type);
        map.propInits.add(new JsonObject.JsonPropInit(sourceInfo, key, value));
      }
      JField mapField = program.createField(sourceInfo,
          "enum$map".toCharArray(), type, map.getType(), true,
          Disposition.FINAL);

      // Initialize in clinit.
      JMethodBody clinitBody = (JMethodBody) type.getMethods().get(0).getBody();
      JExpressionStatement assignment = program.createAssignmentStmt(
View Full Code Here

    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

TOP

Related Classes of com.google.gwt.dev.jjs.ast.js.JsonObject

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.