Examples of ClassExpression


Examples of com.bacoder.parser.java.api.ClassExpression

      case JavaParser.SUPER:
        return createNode(context, SuperExpression.class);
      case JavaParser.Identifier:
        return getAdapter(IdentifierAdapter.class).adapt(firstTerminal);
      case JavaParser.VOID: {
        ClassExpression classExpression = createNode(context, ClassExpression.class);
        classExpression.setType(createNode(firstTerminal, VoidType.class));
        return classExpression;
      }
      default:
      }
    }

    LiteralContext literalContext = getChild(context, LiteralContext.class);
    if (literalContext != null) {
      Literal literal = createNode(context, Literal.class);

      TerminalNode terminal = getChild(literalContext, TerminalNode.class);
      if (terminal != null && LITERAL_TYPE_MAP.containsKey(terminal.getSymbol().getType())) {
        literal.setType(LITERAL_TYPE_MAP.get(terminal.getSymbol().getType()));
        literal.setText(terminal.getText());
      }

      return literal;
    }

    TypeContext typeContext = getChild(context, TypeContext.class);
    if (typeContext != null) {
      ClassExpression classExpression = createNode(context, ClassExpression.class);
      classExpression.setType(getAdapter(TypeAdapter.class).adapt(typeContext));
      return classExpression;
    }

    return processInvocationExpression(context);
  }
View Full Code Here

Examples of com.googlecode.aviator.ClassExpression

     */
    public Expression getResult() {
        endVisitCode();
        byte[] bytes = this.classWriter.toByteArray();
        try {
            return new ClassExpression(classLoader.defineClass(className, bytes));
        }
        catch (Exception e) {
            throw new CompileExpressionErrorException("define class error", e);
        }
    }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.ClassExpression

  private Expression expr;
  private FilterExpression test;
 
  @Before
  public void setup() {
    test = new ClassExpression();
    expr = mock(Expression.class);
    TestExpression.baseExpression = expr;
  }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

            @Override
            public void call(SourceUnit source) throws CompilationFailedException {
                source.getAST().getStatementBlock().visit(new CodeVisitorSupport() {
                    @Override
                    public void visitMethodCallExpression(MethodCallExpression call) {
                        call.setObjectExpression(new ClassExpression(ClassHelper.make(System.class)));
                        call.setMethod(new ConstantExpression("setProperty"));
                        ArgumentListExpression arguments = (ArgumentListExpression) call.getArguments();
                        arguments.addExpression(new ConstantExpression(TEST_EXPECTED_SYSTEMPROP_KEY));
                        arguments.addExpression(new ConstantExpression(TEST_EXPECTED_SYSTEMPROP_VALUE));
                    }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

        // message name
        Expression messageName = new CastExpression(ClassHelper.STRING_TYPE, call.getMethod());
        if (useSuper) {
            ClassNode classNode = controller.isInClosure() ? controller.getOutermostClass() : controller.getClassNode(); // GROOVY-4035
            ClassNode superClass = classNode.getSuperClass();
            makeCall(call, new ClassExpression(superClass),
                    objectExpression, messageName,
                    call.getArguments(), adapter,
                    call.isSafe(), call.isSpreadSafe(),
                    false
            );
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

            MethodCallerMultiAdapter adapter,
            boolean safe, boolean spreadSafe, boolean implicitThis
    ) {
        ClassNode cn = controller.getClassNode();
        if (controller.isInClosure() && !implicitThis && AsmClassGenerator.isThisExpression(receiver)) cn=cn.getOuterClass();
        makeCall(origin, new ClassExpression(cn), receiver, message, arguments,
                adapter, safe, spreadSafe, implicitThis);
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

        return false;
    }

    public void writeInvokeStaticMethod(StaticMethodCallExpression call) {
        makeCall(call,
                new ClassExpression(call.getOwnerType()),
                new ConstantExpression(call.getMethod()),
                call.getArguments(),
                InvocationWriter.invokeStaticMethod,
                false, false, false);
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

            mv.visitMethodInsn(INVOKESTATIC,controller.getInternalClassName(),methodName,"([Ljava/lang/String;)V");
        }

        mv.visitTypeInsn(NEW, CALLSITE_ARRAY_CLASS);
        mv.visitInsn(DUP);
        controller.getAcg().visitClassExpression(new ClassExpression(controller.getClassNode()));

        mv.visitVarInsn(ALOAD, 0);

        mv.visitMethodInsn(INVOKESPECIAL, CALLSITE_ARRAY_CLASS, "<init>", "(Ljava/lang/Class;[Ljava/lang/String;)V");
        mv.visitInsn(ARETURN);
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

        expression.getLeftExpression().visit(controller.getAcg());
        operandStack.box();
        Expression rightExp = expression.getRightExpression();
        ClassNode classType;
        if (rightExp instanceof ClassExpression) {
            ClassExpression classExp = (ClassExpression) rightExp;
            classType = classExp.getType();
        } else {
            throw new RuntimeException(
                    "Right hand side of the instanceof keyword must be a class name, not: " + rightExp);
        }
        String classInternalName = BytecodeHelper.getClassInternalName(classType);
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.ClassExpression

       
        MethodVisitor mv = controller.getMethodVisitor();
        if (coerce) {
            if (top.isDerivedFrom(targetType)) return;
            box();
            (new ClassExpression(targetType)).visit(controller.getAcg());
            remove(1);
            asTypeMethod.call(mv);
            BytecodeHelper.doCast(mv,targetType);
            replace(targetType);
            return;
        }
       
        boolean primTarget = ClassHelper.isPrimitiveType(targetType);
        boolean primTop = ClassHelper.isPrimitiveType(top);

        if (primTop && primTarget) {
            //TODO: use jvm primitive conversions
            // here we box and unbox to get the goal type
            if (convertPrimitive(top, targetType)) {
                replace(targetType);
                return;
            }
            box();
        } else if (primTop) {
            // top is primitive, target is not
            // so box and do groovy cast
            box();
            (new ClassExpression(targetType)).visit(controller.getAcg());
            remove(1);
            castToTypeMethod.call(mv);
        } else if (primTarget) {
            // top is not primitive so unbox
            // leave that BH#doCast later
        } else if (!(top.isDerivedFrom(targetType))) {
            // top and target are not primitive and top is not derived from target
            (new ClassExpression(targetType)).visit(controller.getAcg());
            remove(1);
            castToTypeMethod.call(mv);
        }
        BytecodeHelper.doCast(mv,targetType);
        replace(targetType);
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.