예제 #1
0
  public static BytecodeExpr transformLogicalExpression(
      Expression exp, CompilerTransformer compiler, Label label, boolean onTrue) {
    if (exp instanceof StaticMethodCallExpression) {
      StaticMethodCallExpression smce = (StaticMethodCallExpression) exp;
      MethodCallExpression mce =
          new MethodCallExpression(
              new ClassExpression(smce.getOwnerType()), smce.getMethod(), smce.getArguments());
      mce.setSourcePosition(smce);
      return transformLogicalExpression(mce, compiler, label, onTrue);
    }

    ExprTransformer t = transformers.get(exp.getClass());
    return t.transformLogical(exp, compiler, label, onTrue);
  }
 protected Expression transformBinaryExpression(BinaryExpression be) {
   int type = be.getOperation().getType();
   boolean oldInLeftExpression;
   Expression right = transform(be.getRightExpression());
   be.setRightExpression(right);
   Expression left;
   if (type == Types.EQUAL && be.getLeftExpression() instanceof VariableExpression) {
     oldInLeftExpression = inLeftExpression;
     inLeftExpression = true;
     left = transform(be.getLeftExpression());
     inLeftExpression = oldInLeftExpression;
     if (left instanceof StaticMethodCallExpression) {
       StaticMethodCallExpression smce = (StaticMethodCallExpression) left;
       StaticMethodCallExpression result =
           new StaticMethodCallExpression(smce.getOwnerType(), smce.getMethod(), right);
       setSourcePosition(result, be);
       return result;
     }
   } else {
     left = transform(be.getLeftExpression());
   }
   be.setLeftExpression(left);
   return be;
 }