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

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


      }
    }

    // @Override
    public void endVisit(JFieldRef x, Context ctx) {
      JField field = x.getField();
      JsName jsFieldName = getName(field);
      JsNameRef nameRef = jsFieldName.makeRef();
      JsExpression curExpr = nameRef;

      /*
       * Note: the comma expressions here would cause an illegal tree state if
       * the result expression ended up on the lhs of an assignment. A hack in
       * in endVisit(JBinaryOperation) rectifies the situation.
       */

      // See if we need a clinit
      JsInvocation jsInvocation = maybeCreateClinitCall(field);
      if (jsInvocation != null) {
        curExpr = createCommaExpression(jsInvocation, curExpr);
      }

      if (x.getInstance() != null) {
        JsExpression qualifier = (JsExpression) pop();
        if (field.isStatic()) {
          // unnecessary qualifier, create a comma expression
          curExpr = createCommaExpression(qualifier, curExpr);
        } else {
          // necessary qualifier, qualify the name ref
          nameRef.setQualifier(qualifier);
View Full Code Here


          String ident = x.getIdent();
          if (ident.charAt(0) == '@') {
            HasEnclosingType node = (HasEnclosingType) program.jsniMap.get(ident);
            assert (node != null);
            if (node instanceof JField) {
              JField field = (JField) node;
              JsName jsName = getName(field);
              assert (jsName != null);
              x.resolve(jsName);

              // See if we need to add a clinit call to a static field ref
View Full Code Here

    }

    private void generateTypeId(JClassType x, JsStatements globalStmts) {
      int typeId = program.getTypeId(x);
      if (typeId >= 0) {
        JField typeIdField = program.getSpecialField("Object.typeId");
        JsNameRef fieldRef = getName(typeIdField).makeRef();
        fieldRef.setQualifier(globalTemp.makeRef());
        JsIntegralLiteral typeIdLit = jsProgram.getIntegralLiteral(BigInteger.valueOf(typeId));
        JsExpression asg = createAssignment(fieldRef, typeIdLit);
        globalStmts.add(new JsExprStmt(asg));
View Full Code Here

        globalStmts.add(new JsExprStmt(asg));
      }
    }

    private void generateTypeName(JClassType x, JsStatements globalStmts) {
      JField typeIdField = program.getSpecialField("Object.typeName");
      JsNameRef lhs = getName(typeIdField).makeRef();
      lhs.setQualifier(globalTemp.makeRef());

      // Split the full class name into package + class so package strings
      // can be merged.
View Full Code Here

      JsExpression asg = createAssignment(lhs, rhs);
      globalStmts.add(new JsExprStmt(asg));
    }

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

    }

    // @Override
    public void endVisit(JProgram x, Context ctx) {
      // visit special things that may have been culled
      JField field = x.getSpecialField("Object.typeId");
      names.put(field, objectScope.declareName(mangleName(field),
          field.getName()));

      field = x.getSpecialField("Object.typeName");
      names.put(field, objectScope.declareName(mangleName(field),
          field.getName()));

      field = x.getSpecialField("Cast.typeIdArray");
      names.put(field, topScope.declareName(mangleName(field), field.getName()));

      /*
       * put the null method and field into objectScope since they can be
       * referenced as instance on null-types (as determined by type flow)
       */
      JMethod nullMethod = x.getNullMethod();
      polymorphicNames.put(nullMethod,
          objectScope.declareName(nullMethod.getName()));
      JField nullField = x.getNullField();
      JsName nullFieldName = objectScope.declareName(nullField.getName());
      polymorphicNames.put(nullField, nullFieldName);
      names.put(nullField, nullFieldName);

      /*
       * put nullMethod in the global scope, too; it's the replacer for clinits
View Full Code Here

    super.visit(x, ctx);

    openBlock();

    for (int i = 0; i < x.fields.size(); ++i) {
      JField it = (JField) x.fields.get(i);
      accept(it);
      newline();
      newline();
    }
    for (int i = 0; i < x.methods.size(); ++i) {
View Full Code Here

    super.visit(x, ctx);

    openBlock();

    for (int i = 0; i < x.fields.size(); ++i) {
      JField field = (JField) x.fields.get(i);
      accept(field);
      newline();
      newline();
    }
    for (int i = 0; i < x.methods.size(); ++i) {
View Full Code Here

    }

    private JField createField(SourceInfo info, FieldBinding binding,
        JReferenceType enclosingType, boolean hasInitializer) {
      JType type = (JType) typeMap.get(binding.type);
      JField field = program.createField(info, binding.name, enclosingType,
          type, binding.isStatic(), binding.isFinal(), hasInitializer);
      typeMap.put(binding, field);
      return field;
    }
View Full Code Here

    }

    private JField createField(SyntheticArgumentBinding binding,
        JReferenceType enclosingType) {
      JType type = (JType) typeMap.get(binding.type);
      JField field = program.createField(null, binding.name, enclosingType,
          type, false, true, true);
      if (binding.matchingField != null) {
        typeMap.put(binding.matchingField, field);
      }
      typeMap.put(binding, field);
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JField

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.