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

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


        initializers.add(createDeclaration(info, maxVar, new JFieldRef(program,
            info, createVariableRef(info, arrayVar),
            program.getIndexedField("Array.length"), currentClass)));

        // i$index < i$max
        JExpression condition = new JBinaryOperation(program, info,
            program.getTypePrimitiveBoolean(), JBinaryOperator.LT,
            createVariableRef(info, indexVar), createVariableRef(info, maxVar));

        // ++i$index
        List<JExpressionStatement> increments = new ArrayList<JExpressionStatement>(
View Full Code Here


     */
    private JExpression processBinaryOperation(SourceInfo info,
        JBinaryOperator op, JType type, Expression arg1, Expression arg2) {
      JExpression exprArg1 = dispProcessExpression(arg1);
      JExpression exprArg2 = dispProcessExpression(arg2);
      JBinaryOperation binaryOperation = new JBinaryOperation(program, info,
          type, op, exprArg1, exprArg2);
      return binaryOperation;
    }
View Full Code Here

      JMethodCall rhs = new JMethodCall(program, x.getSourceInfo(), null,
          method);
      if (x.getArg() != null) {
        rhs.getArgs().add(x.getArg());
      }
      JBinaryOperation binOp = new JBinaryOperation(program, x.getSourceInfo(),
          program.getTypePrimitiveBoolean(), JBinaryOperator.OR, lhs, rhs);
      ctx.replaceMe(binOp.makeStatement());
    }
View Full Code Here

      if ((USE_TRIPLE_EQUALS[lhsStatus.getIndex()][rhsStatus.getIndex()] == 1)) {
        // Mask each side to prevent null === undefined.
        lhs = maskUndefined(lhs);
        rhs = maskUndefined(rhs);
        JBinaryOperation binOp = new JBinaryOperation(program,
            x.getSourceInfo(), x.getType(), x.getOp(), lhs, rhs);
        ctx.replaceMe(binOp);
      } else {
        boolean lhsNullLit = lhs == program.getLiteralNull();
        boolean rhsNullLit = rhs == program.getLiteralNull();
View Full Code Here

      if (x.getOp() == JBinaryOperator.ADD) {
        JExpression newLhs = convertString(x.getLhs());
        JExpression newRhs = convertString(x.getRhs());
        if (newLhs != x.getLhs() || newRhs != x.getRhs()) {
          JBinaryOperation newExpr = new JBinaryOperation(program,
              x.getSourceInfo(), program.getTypeJavaLangString(),
              JBinaryOperator.ADD, newLhs, newRhs);
          ctx.replaceMe(newExpr);
        }
      } else if (x.getOp() == JBinaryOperator.ASG_ADD) {
        JExpression newRhs = convertString(x.getRhs());
        if (newRhs != x.getRhs()) {
          JBinaryOperation newExpr = new JBinaryOperation(program,
              x.getSourceInfo(), program.getTypeJavaLangString(),
              JBinaryOperator.ASG_ADD, x.getLhs(), newRhs);
          ctx.replaceMe(newExpr);
        }
      }
View Full Code Here

      }

      JExpression newLhs = checkAndReplace(x.getLhs(), lhsType);
      JExpression newRhs = checkAndReplace(x.getRhs(), rhsType);
      if (newLhs != x.getLhs() || newRhs != x.getRhs()) {
        JBinaryOperation binOp = new JBinaryOperation(program,
            x.getSourceInfo(), resultType, x.getOp(), newLhs, newRhs);
        ctx.replaceMe(binOp);
      }
    }
View Full Code Here

    if (boxed != null) {
      // Assignment-to-unbox, e.g.
      // unbox(x) = foo -> x = box(foo)
      JClassType boxedType = (JClassType) boxed.getType();

      ctx.replaceMe(new JBinaryOperation(program, x.getSourceInfo(), boxedType,
          JBinaryOperator.ASG, boxed, autoboxUtils.box(x.getRhs(), boxedType)));
      return;
    }

    if (lhs instanceof JCastOperation) {
      // Assignment-to-cast-operation, e.g.
      // (Foo) x = foo -> x = foo
      JCastOperation cast = (JCastOperation) lhs;
      JBinaryOperation newAsg = new JBinaryOperation(program,
          x.getSourceInfo(), x.getType(), JBinaryOperator.ASG, cast.getExpr(),
          x.getRhs());
      ctx.replaceMe(newAsg);
    }
  }
View Full Code Here

      ReplaceSideEffectsInLvalue replacer = new ReplaceSideEffectsInLvalue(
          new JMultiExpression(program, x.getSourceInfo()));
      JExpression newLhs = replacer.accept(x.getLhs());
      exitTempUsageScope();

      JBinaryOperation operation = new JBinaryOperation(program,
          x.getSourceInfo(), newLhs.getType(), op.getNonAssignmentOf(), newLhs,
          x.getRhs());
      // newLhs is cloned below because it was used in operation
      JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
          newLhs.getType(), JBinaryOperator.ASG,
          cloner.cloneExpression(newLhs), operation);

      JMultiExpression multiExpr = replacer.getMultiExpr();
      if (multiExpr.exprs.isEmpty()) {
View Full Code Here

      // Now generate the appropriate expressions.
      JLocal tempLocal = getTempLocal(expressionReturn.getType());

      // t = x
      JLocalRef tempRef = new JLocalRef(program, x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
          x.getType(), JBinaryOperator.ASG, tempRef, expressionReturn);
      multi.exprs.add(asg);

      // x += 1
      asg = createAsgOpFromUnary(newArg, op);
View Full Code Here

        return;
      }

      // Convert into the equivalent binary assignment operation, such as:
      // x += 1
      JBinaryOperation asg = createAsgOpFromUnary(x.getArg(), op);

      // Visit the result to break it up even more.
      ctx.replaceMe(accept(asg));
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.ast.JBinaryOperation

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.