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

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


            if (nestedBinding.enclosingInstances != null) {
              for (int i = 0; i < nestedBinding.enclosingInstances.length; ++i) {
                SyntheticArgumentBinding arg = nestedBinding.enclosingInstances[i];
                JParameter param = (JParameter) paramIt.next();
                if (arg.matchingField != null) {
                  JField field = (JField) typeMap.get(arg);
                  ctor.body.statements.add(program.createAssignmentStmt(info,
                      createVariableRef(info, field), createVariableRef(info,
                          param)));
                }
              }
            }

            if (nestedBinding.outerLocalVariables != null) {
              for (int i = 0; i < nestedBinding.outerLocalVariables.length; ++i) {
                SyntheticArgumentBinding arg = nestedBinding.outerLocalVariables[i];
                JParameter param = (JParameter) paramIt.next();
                JField field = (JField) typeMap.get(arg);
                ctor.body.statements.add(program.createAssignmentStmt(info,
                    createVariableRef(info, field), createVariableRef(info,
                        param)));
              }
            }
View Full Code Here


    }

    JExpression processExpression(FieldReference x) {
      SourceInfo info = makeSourceInfo(x);
      FieldBinding fieldBinding = x.binding;
      JField field;
      if (fieldBinding.declaringClass == null) {
        // probably array.length
        field = program.getSpecialField("Array.length");
        if (!field.getName().equals(String.valueOf(fieldBinding.name))) {
          throw new InternalCompilerException("Error matching fieldBinding.");
        }
      } else {
        field = (JField) typeMap.get(fieldBinding);
      }
View Full Code Here

       * otherBindings takes the current expression as a qualifier.
       */
      if (x.otherBindings != null) {
        for (int i = 0; i < x.otherBindings.length; i++) {
          FieldBinding fieldBinding = x.otherBindings[i];
          JField field;
          if (fieldBinding.declaringClass == null) {
            // probably array.length
            field = program.getSpecialField("Array.length");
            if (!field.getName().equals(String.valueOf(fieldBinding.name))) {
              throw new InternalCompilerException(
                  "Error matching fieldBinding.");
            }
          } else {
            field = (JField) typeMap.get(fieldBinding);
View Full Code Here

       * can have them, apparently), this is a ref to a field in an enclosing
       * instance. CreateThisRef should compute a "this" access of the
       * appropriate type, unless the field is static.
       */
      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

          dispProcessExpression(x.expression));
      return preOp;
    }

    void processField(FieldDeclaration declaration) {
      JField field = (JField) typeMap.tryGet(declaration.binding);
      if (field == null) {
        /*
         * When anonymous classes declare constant fields, the field declaration
         * is not visited by JDT. Just bail since any references to that field
         * are guaranteed to be replaced with literals.
View Full Code Here

        if (isField) {
          /*
           * TODO FIXME HACK: We should be replacing compile-time constant refs
           * from JSNI with the literal value of the field.
           */
          JField field = (JField) node;
          JsniFieldRef fieldRef = new JsniFieldRef(program, info, field,
              currentClass);
          nativeMethod.jsniFieldRefs.add(fieldRef);
        } else {
          JMethod method = (JMethod) node;
View Full Code Here

    }

    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

          throw new InternalCompilerException(
              "ParameterRef referencing param in a different method.");
        }
        return new JParameterRef(program, info, parameter);
      } else if (variable instanceof JField) {
        JField field = (JField) variable;
        JExpression instance = null;
        if (!field.isStatic()) {
          JClassType fieldEnclosingType = (JClassType) field.getEnclosingType();
          instance = createThisRef(info, fieldEnclosingType);
          if (!program.typeOracle.canTriviallyCast(
              (JClassType) instance.getType(), fieldEnclosingType)) {
            throw new InternalCompilerException(
                "FieldRef referencing field in a different type.");
View Full Code Here

      String rhs = parts[1];
      int parenPos = rhs.indexOf('(');
      if (parenPos < 0) {
        // look for a field
        for (int i = 0; i < type.fields.size(); ++i) {
          JField field = (JField) type.fields.get(i);
          if (field.getName().equals(rhs)) {
            return field;
          }
        }

        reportJsniError(info, x, "Unresolvable native reference to 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

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.