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

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


      } else {
        // int is safe to add to all other types
        one = program.getLiteralInt(1);
      }
      // arg is cloned below because the caller is allowed to use it somewhere
      JBinaryOperation asg = new JBinaryOperation(program, arg.getSourceInfo(),
          arg.getType(), newOp, cloner.cloneExpression(arg), one);
      return asg;
    }
View Full Code Here


      // Create a temp local
      JLocal tempLocal = getTempLocal(x.getType());

      // Create an assignment for this temp and add it to multi.
      JLocalRef tempRef = new JLocalRef(program, x.getSourceInfo(), tempLocal);
      JBinaryOperation asg = new JBinaryOperation(program, x.getSourceInfo(),
          x.getType(), JBinaryOperator.ASG, tempRef, x);
      multi.exprs.add(asg);
      // Update me with the temp
      return cloner.cloneExpression(tempRef);
    }
View Full Code Here

    return false;
  }

  @Override
  public boolean visit(JBinaryOperation x, Context ctx) {
    expression = new JBinaryOperation(program, x.getSourceInfo(), x.getType(),
        x.getOp(), cloneExpression(x.getLhs()), cloneExpression(x.getRhs()));
    return false;
  }
View Full Code Here

      JReferenceType argType = (JReferenceType) x.getExpr().getType();
      JReferenceType toType = x.getTestType();
      if (program.typeOracle.canTriviallyCast(argType, toType)) {
        // trivially true if non-null; replace with a null test
        JNullLiteral nullLit = program.getLiteralNull();
        JBinaryOperation eq = new JBinaryOperation(program, x.getSourceInfo(),
            program.getTypePrimitiveBoolean(), JBinaryOperator.NEQ,
            x.getExpr(), nullLit);
        ctx.replaceMe(eq);
      } else {
        boolean isJsoCast = program.isJavaScriptObject(toType);
View Full Code Here

  }

  @Override
  public boolean visit(JBinaryOperation x, Context ctx) {
    expression =
        new JBinaryOperation(x.getSourceInfo(), x.getType(), x.getOp(),
            cloneExpression(x.getLhs()), cloneExpression(x.getRhs()));
    return false;
  }
View Full Code Here

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

      JExpression operation =
          new JBinaryOperation(x.getSourceInfo(), newLhs.getType(), op.getNonAssignmentOf(),
              newLhs, x.getRhs());
      operation = modifyResultOperation((JBinaryOperation) operation);

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

      JMultiExpression multiExpr = replacer.getMultiExpr();
      if (multiExpr.isEmpty()) {
        // just use the split assignment expression
View Full Code Here

      // Now generate the appropriate expressions.
      JLocal tempLocal = createTempLocal(x.getSourceInfo(), expressionReturn.getType());

      // t = x
      JLocalRef tempRef = new JLocalRef(x.getSourceInfo(), tempLocal);
      JBinaryOperation asg =
          new JBinaryOperation(x.getSourceInfo(), x.getType(), JBinaryOperator.ASG, tempRef,
              expressionReturn);
      multi.addExpressions(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

      } else {
        // int is safe to add to all other types
        one = JIntLiteral.get(1);
      }
      // arg is cloned below because the caller is allowed to use it somewhere
      JBinaryOperation asg =
          new JBinaryOperation(arg.getSourceInfo(), arg.getType(), newOp, cloner
              .cloneExpression(arg), one);
      return asg;
    }
View Full Code Here

        // Create a temp local
        JLocal tempLocal = createTempLocal(x.getSourceInfo(), x.getType());

        // Create an assignment for this temp and add it to multi.
        JLocalRef tempRef = new JLocalRef(x.getSourceInfo(), tempLocal);
        JBinaryOperation asg =
            new JBinaryOperation(x.getSourceInfo(), x.getType(), JBinaryOperator.ASG, tempRef, x);
        multi.addExpressions(asg);
        // Update me with the temp
        return cloner.cloneExpression(tempRef);
      }
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.