Examples of JFieldRef


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

      // return new E[]{A,B,C};
      SourceInfo sourceInfo = type.getSourceInfo().makeChild(
          JavaASTGenerationVisitor.class, "enum values method");
      List<JExpression> initializers = new ArrayList<JExpression>();
      for (JEnumField field : type.getEnumList()) {
        JFieldRef fieldRef = new JFieldRef(sourceInfo, null, field, type);
        initializers.add(fieldRef);
      }
      JNewArray newExpr = JNewArray.createInitializers(program, sourceInfo,
          program.getTypeArray(type, 1), initializers);
      currentMethodBody.getBlock().addStmt(
View Full Code Here

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

    assert instance != null;
    if (!instance.hasSideEffects()) {
      instance = program.getLiteralNull();
    }

    JFieldRef fieldRef = new JFieldRef(x.getSourceInfo(), instance,
        program.getNullField(), x.getEnclosingType(), primitiveTypeOrNullType(
            program, x.getType()));
    return fieldRef;
  }
View Full Code Here

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

        return;
      }

      if (isPruned(x.getField())) {
        // The field is gone; replace x by a null field reference.
        JFieldRef fieldRef = transformToNullFieldRef(x, program);
        ctx.replaceMe(fieldRef);
      }
    }
View Full Code Here

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

      // Replace with a multi, which may wind up empty.
      JMultiExpression multi = new JMultiExpression(info);

      // If the lhs is a field ref, evaluate it first.
      if (variableRef instanceof JFieldRef) {
        JFieldRef fieldRef = (JFieldRef) variableRef;
        JExpression instance = fieldRef.getInstance();
        if (instance != null) {
          multi.exprs.add(instance);
        }
      }
View Full Code Here

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

          // parameters are ok to skip
          doSkip = true;
        } else if (lhs instanceof JFieldRef) {
          // fields must rescue the qualifier
          doSkip = true;
          JFieldRef fieldRef = (JFieldRef) lhs;
          JExpression instance = fieldRef.getInstance();
          if (instance != null) {
            accept(instance);
          }
        }
View Full Code Here

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

      }

      // If the lhs is a field ref, we have to visit its qualifier.
      JVariableRef variableRef = x.getVariableRef();
      if (variableRef instanceof JFieldRef) {
        JFieldRef fieldRef = (JFieldRef) variableRef;
        JExpression instance = fieldRef.getInstance();
        if (instance != null) {
          accept(instance);
        }
      }
      return false;
View Full Code Here

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

      return false;
    }

    private boolean isVolatileField(JExpression x) {
      if (x instanceof JFieldRef) {
        JFieldRef xFieldRef = (JFieldRef) x;
        if (xFieldRef.getField().isVolatile()) {
          return true;
        }
      }

      return false;
View Full Code Here

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

    return false;
  }

  @Override
  public boolean visit(JFieldRef x, Context ctx) {
    expression = new JFieldRef(x.getSourceInfo(),
        cloneExpression(x.getInstance()), x.getField(), x.getEnclosingType());
    return false;
  }
View Full Code Here

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

    @Override
    public boolean visit(JFieldRef x, Context ctx) {
      if (x.getInstance() != null) {
        JExpression newInstance = possiblyReplace(x.getInstance());
        if (newInstance != x.getInstance()) {
          JFieldRef newExpr = new JFieldRef(x.getSourceInfo(), newInstance,
              x.getField(), x.getEnclosingType());
          ctx.replaceMe(newExpr);
        }
      }
      return false;
View Full Code Here

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

          // cannot skip
        } else if (lhs instanceof JLocalRef) {
          // locals are ok to skip
          doSkip = true;
        } else if (lhs instanceof JFieldRef) {
          JFieldRef fieldRef = (JFieldRef) lhs;
          /*
           * Whether we can skip depends on what the qualifier is; we have to be
           * certain the qualifier cannot be a null pointer (in which case we'd
           * fail to throw the appropriate exception.
           *
           * TODO: better non-null tracking!
           */
          JExpression instance = fieldRef.getInstance();
          if (fieldRef.getField().isStatic()) {
            // statics are always okay
            doSkip = true;
          } else if (instance instanceof JThisRef) {
            // a this ref cannot be null
            doSkip = true;
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.