Examples of JArrayRef


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

        JExpression instance = ((JFieldRef) expression).getInstance();
        if (instance != null) {
          accept(instance);
        }
      } else if (expression instanceof JArrayRef) {
        JArrayRef arrayRef = (JArrayRef) expression;
        accept(arrayRef.getInstance());
        accept(arrayRef.getIndexExpr());
      } else if (!(expression instanceof JVariableRef)) {
        throw new IllegalArgumentException("Unexpected lhs: " + expression);
      }
    }
View Full Code Here

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

    return false;
  }

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

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

    public void endVisit(ArrayReference x, BlockScope scope) {
      try {
        SourceInfo info = makeSourceInfo(x);
        JExpression position = pop(x.position);
        JExpression receiver = pop(x.receiver);
        push(new JArrayRef(info, receiver, position));
      } catch (Throwable e) {
        throw translateException(x, e);
      }
    }
View Full Code Here

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

          JExpression increments = new JPrefixOperation(info, JUnaryOperator.INC,
              new JLocalRef(info, indexVar));

          // T elementVar = i$array[i$index];
          elementDecl.initializer =
              new JArrayRef(info, new JLocalRef(info, arrayVar), new JLocalRef(info, indexVar));
          body.addStmt(0, elementDecl);

          result = new JForStatement(info, initializers, condition, increments, body);
        } else {
          /**
 
View Full Code Here

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

    public void endVisit(ArrayReference x, BlockScope scope) {
      try {
        SourceInfo info = makeSourceInfo(x);
        JExpression position = pop(x.position);
        JExpression receiver = pop(x.receiver);
        push(new JArrayRef(info, receiver, position));
      } catch (Throwable e) {
        throw translateException(x, e);
      }
    }
View Full Code Here

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

          increments.add(new JPrefixOperation(info, JUnaryOperator.INC, new JLocalRef(info,
              indexVar)).makeStatement());

          // T elementVar = i$array[i$index];
          elementDecl.initializer =
              new JArrayRef(info, new JLocalRef(info, arrayVar), new JLocalRef(info, indexVar));
          body.addStmt(0, elementDecl);

          result = new JForStatement(info, initializers, condition, increments, body);
        } else {
          /**
 
View Full Code Here

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

  private class ArrayVisitor extends JModVisitor {

    @Override
    public void endVisit(JBinaryOperation x, Context ctx) {
      if (x.getOp() == JBinaryOperator.ASG && x.getLhs() instanceof JArrayRef) {
        JArrayRef arrayRef = (JArrayRef) x.getLhs();
        JType elementType = arrayRef.getType();
        if (elementType instanceof JNullType) {
          // will generate a null pointer exception instead
          return;
        }

        /*
         * See if we need to do a checked store. Primitives and (effectively)
         * final are statically correct.
         */
        if (elementType instanceof JReferenceType) {
          if (!((JReferenceType) elementType).isFinal()
              || !program.typeOracle.canTriviallyCast(
                  (JReferenceType) x.getRhs().getType(),
                  (JReferenceType) elementType)) {
            // replace this assignment with a call to setCheck()
            JMethodCall call = new JMethodCall(x.getSourceInfo(), null,
                setCheckMethod);
            call.addArgs(arrayRef.getInstance(), arrayRef.getIndexExpr(),
                x.getRhs());
            ctx.replaceMe(call);
          }
        }
      }
View Full Code Here

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

    return false;
  }

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

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

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

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

      return JNewArray.createInitializers(info, type, initializers);
    }

    JExpression processExpression(ArrayReference x) {
      SourceInfo info = makeSourceInfo(x);
      JArrayRef arrayRef = new JArrayRef(info,
          dispProcessExpression(x.receiver), dispProcessExpression(x.position));
      return arrayRef;
    }
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.