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[queryIds.get(yesType)] = yesType;
        }
      }

      // Create a sparse lookup object.
      JsonObject jsonObject = new JsonObject(program);
      // Start at 1; 0 is Object and always true.
      for (int i = 1; i < nextQueryId; ++i) {
        if (yesArray[i] != null) {
          JIntLiteral labelExpr = program.getLiteralInt(i);
          JIntLiteral valueExpr = program.getLiteralInt(1);
View Full Code Here

    }

    private JsExpression generateTypeTable() {
      JsArrayLiteral arrayLit = new JsArrayLiteral();
      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

    // ensure jsonCastableTypeMaps has been initialized
    // it might not have been if the CastNormalizer has not been run
    if (castableTypeMaps == null) {
      initTypeInfo(null);
    }
    JsonObject returnMap = castableTypeMaps.get(referenceType);
    if (returnMap == null) {
      // add a new empty map
      returnMap = new JsonObject(createSourceInfoSynthetic(JProgram.class),
          getJavaScriptObject());
      castableTypeMaps.put(referenceType, returnMap);
    }
    return returnMap;
  }
View Full Code Here

    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));
View Full Code Here

        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);
View Full Code Here

      // 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

          lhs, rhs);
    }

    private void generateCastableTypeMap(JClassType x,
        List<JsStatement> globalStmts) {
      JsonObject castableTypeMap = program.getCastableTypeMap(x);
      if (castableTypeMap != null) {
        JField castableTypeMapField = program.getIndexedField("Object.castableTypeMap");
        JsName castableTypeMapName = names.get(castableTypeMapField);
        if (castableTypeMapName == null) {
          // Was pruned; this compilation must have no dynamic casts.
View Full Code Here

      scopeStack.push(scope);
    }

    private void recordSymbol(JReferenceType x, JsName jsName) {
      int queryId = program.getQueryId(x);
      JsonObject castableTypeMapObj = program.getCastableTypeMap(x);
      CastableTypeMap castableTypeMap = new StandardCastableTypeMap(
          castableTypeMapObj.toString());

      StandardSymbolData symbolData = StandardSymbolData.forClass(x.getName(),
          x.getSourceInfo().getFileName(), x.getSourceInfo().getStartLine(),
          queryId, castableTypeMap);
      assert !symbolTable.containsKey(symbolData);
View Full Code Here

        }
      }

      // Create a sparse lookup object.
      SourceInfo sourceInfo = program.createSourceInfoSynthetic(AssignTypeCastabilityVisitor.class);
      JsonObject jsonObject = new JsonObject(sourceInfo,
          program.getJavaScriptObject());
      // Start at 1; 0 is Object and always true.
      for (int i = 1; i < nextQueryId; ++i) {
        if (yesArray[i] != null) {
          JIntLiteral labelExpr = program.getLiteralInt(i);
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.