Exemplo n.º 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);
  }
Exemplo n.º 2
0
  public static Expression transformExpression(final Expression exp, CompilerTransformer compiler) {
    if (exp instanceof BytecodeExpression) {
      if (exp instanceof BytecodeExpr) return exp;

      return new BytecodeExpr(exp, exp.getType()) {
        protected void compile(MethodVisitor mv) {
          ((BytecodeExpression) exp).visit(mv);
        }
      };
    }

    ExprTransformer t = transformers.get(exp.getClass());
    if (t == null) return compiler.transformImpl(exp);

    return t.transform(exp, compiler);
  }