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

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


   *
   * Whenever this method is updated, also look at
   * {@link #containsRemovableVars(JsStatement)}.
   */
  private boolean isLive(JsVar var, LivenessPredicate livenessPredicate) {
    JField field = map.nameToField(var.getName());
    if (field != null) {
      // It's a field
      return livenessPredicate.isLive(field);
    }

View Full Code Here


      }
    }

    @Override
    public void endVisit(JFieldRef x, Context ctx) {
      JField field = x.getField();
      JsName jsFieldName = names.get(field);
      JsNameRef nameRef = jsFieldName.makeRef(x.getSourceInfo());
      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 = program.jsniMap.get(ident);
            assert (node != null);
            if (node instanceof JField) {
              JField field = (JField) node;
              JsName jsName = names.get(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

      return new JsBinaryOperation(lhs.getSourceInfo(), JsBinaryOperator.COMMA,
          lhs, rhs);
    }

    private void generateClassLiteral(JDeclarationStatement decl, JsVars vars) {
      JField field = (JField) decl.getVariableRef().getTarget();
      JsName jsName = names.get(field);
      this.accept(decl.getInitializer());
      JsExpression classObjectAlloc = pop();
      JsVar var = new JsVar(decl.getSourceInfo(), jsName);
      var.setInitExpr(classObjectAlloc);
View Full Code Here

    }

    private void generateTypeId(JClassType x, List<JsStatement> globalStmts) {
      int typeId = program.getTypeId(x);
      if (typeId >= 0) {
        JField typeIdField = program.getIndexedField("Object.typeId");
        JsName typeIdName = names.get(typeIdField);
        if (typeIdName == null) {
          // Was pruned; this compilation must have no dynamic casts.
          return;
        }
View Full Code Here

        typeForStatMap.put(asgStmt, x);
      }
    }

    private void generateTypeMarker(List<JsStatement> globalStmts) {
      JField typeMarkerField = program.getIndexedField("Object.typeMarker");
      JsName typeMarkerName = names.get(typeMarkerField);
      if (typeMarkerName == null) {
        // Was pruned; this compilation must have no JSO instanceof tests.
        return;
      }
View Full Code Here

  /**
   * Extract the initializer of AsyncFragmentLoader.BROWSER_LOADER. A couple of
   * parts of the compiler modify this constructor call.
   */
  static JMethodCall getBrowserLoaderConstructor(JProgram program) {
    JField field = program.getIndexedField("AsyncFragmentLoader.BROWSER_LOADER");
    JMethodCall constructorCall = (JMethodCall) field.getDeclarationStatement().getInitializer();
    assert constructorCall.getArgs().size() == 4;
    return constructorCall;
  }
View Full Code Here

    @Override
    public void endVisit(JsniFieldRef x, Context ctx) {
      if (isPruned(x.getField())) {
        String ident = x.getIdent();
        JField nullField = program.getNullField();
        program.jsniMap.put(ident, nullField);
        JsniFieldRef nullFieldRef = new JsniFieldRef(x.getSourceInfo(), ident,
            nullField, x.getEnclosingType(), x.isLvalue());
        ctx.replaceMe(nullFieldRef);
      }
View Full Code Here

      assert (referencedTypes.contains(type));
      boolean isInstantiated = program.typeOracle.isInstantiatedType(type);

      for (int i = 0; i < type.getFields().size(); ++i) {
        JField field = type.getFields().get(i);
        if (!referencedNonTypes.contains(field)
            || pruneViaNoninstantiability(isInstantiated, field)) {
          type.removeField(i);
          didChange = true;
          --i;
View Full Code Here

    public boolean visit(JInterfaceType type, Context ctx) {
      boolean isReferenced = referencedTypes.contains(type);
      boolean isInstantiated = program.typeOracle.isInstantiatedType(type);

      for (int i = 0; i < type.getFields().size(); ++i) {
        JField field = type.getFields().get(i);
        // all interface fields are static and final
        if (!isReferenced || !referencedNonTypes.contains(field)) {
          type.removeField(i);
          didChange = true;
          --i;
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.