Examples of JFieldRef


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

        int i = params.indexOf(((JParameterRef) targetExpr).getTarget());
        assert (i >= 0);
        magicArg[0] = i;
        return (JExpression) args.get(i);
      } else if (targetExpr instanceof JFieldRef) {
        JFieldRef oldFieldRef = (JFieldRef) targetExpr;
        JField field = oldFieldRef.getField();
        JExpression instance = oldFieldRef.getInstance();
        if (instance != null) {
          // If an instance field, we have to be able to inline the qualifier
          instance = canInlineExpression(info, instance, params, args, magicArg);
          if (instance == null) {
            return null;
          }
        }
        JFieldRef newFieldRef = new JFieldRef(program, info, instance, field,
            currentMethod.getEnclosingType());
        return newFieldRef;
      } else {
        /*
         * For now, only inline REALLY trivial stuff since we have no way of
View Full Code Here

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

      // resultExpression might be null, which behaves correctly here.
      if (!(resultExpression instanceof JFieldRef)) {
        return true;
      }
      JFieldRef fieldRefResult = (JFieldRef) resultExpression;
      JField fieldResult = fieldRefResult.getField();
      if (!fieldResult.isStatic()) {
        // A nonstatic field reference won't trigger the clinit we need.
        return true;
      }
      if (fieldResult.getEnclosingType() != targetEnclosingType) {
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(program, 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

      boolean isStatic = x.getField().isStatic();
      if (isStatic && instance != null) {
        // this doesn't really belong here, but while we're here let's remove
        // non-side-effect qualifiers to statics
        if (!instance.hasSideEffects()) {
          JFieldRef fieldRef = new JFieldRef(program, x.getSourceInfo(), null,
              x.getField(), x.getEnclosingType());
          ctx.replaceMe(fieldRef);
        }
      } else if (!isStatic && instance.getType() == typeNull) {
        if (!instance.hasSideEffects()) {
          instance = program.getLiteralNull();
        }
        JFieldRef fieldRef = new JFieldRef(program, x.getSourceInfo(),
            instance, program.getNullField(), null);
        ctx.replaceMe(fieldRef);
      }
    }
View Full Code Here

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

        }
      } else {
        field = (JField) typeMap.get(fieldBinding);
      }
      JExpression instance = dispProcessExpression(x.receiver);
      JExpression fieldRef = new JFieldRef(program, info, instance, field,
          currentClass);
      return fieldRef;
    }
View Full Code Here

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

                  "Error matching fieldBinding.");
            }
          } else {
            field = (JField) typeMap.get(fieldBinding);
          }
          curRef = new JFieldRef(program, info, curRef, field, currentClass);
        }
      }

      return curRef;
    }
View Full Code Here

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

       */
      if (x.syntheticAccessors != null) {
        JField field = (JField) variable;
        if (!field.isStatic()) {
          JExpression instance = createThisRef(info, field.getEnclosingType());
          return new JFieldRef(program, info, instance, field, currentClass);
        }
      }

      return createVariableRef(info, variable, binding);
    }
View Full Code Here

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

    private void addAllOuterThisRefs(List list, JExpression expr,
        JClassType classType) {
      if (classType.fields.size() > 0) {
        JField field = (JField) classType.fields.get(0);
        if (field.getName().startsWith("this$")) {
          list.add(new JFieldRef(program, expr.getSourceInfo(), expr, field,
              currentClass));
        }
      }
    }
View Full Code Here

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

              (JClassType) instance.getType(), fieldEnclosingType)) {
            throw new InternalCompilerException(
                "FieldRef referencing field in a different type.");
          }
        }
        return new JFieldRef(program, info, instance, field, currentClass);
      }
      throw new InternalCompilerException("Unknown JVariable subclass.");
    }
View Full Code Here

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

     */
    @Override
    public boolean visit(JField x, Context ctx) {
      if (x instanceof JEnumField && canBeOrdinal(x.getEnclosingType())) {
        int ordinal = ((JEnumField) x).ordinal();
        x.setInitializer(new JDeclarationStatement(x.getSourceInfo(), new JFieldRef(x
            .getSourceInfo(), null, x, x.getEnclosingType()), program.getLiteralInt(ordinal)));
      }
      return 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.