Examples of JCStatement


Examples of com.sun.tools.javac.tree.JCTree.JCStatement

    // Statement expressions
   
    public JCStatement transform(Tree.ExpressionStatement tree) {
        // ExpressionStatements do not return any value, therefore we don't care about the type of the expressions.
        inStatement = true;
        JCStatement result;
        HasErrorException error = errors().getFirstExpressionErrorAndMarkBrokenness(tree.getExpression());
        if (error != null) {
            result = this.makeThrowUnresolvedCompilationError(error);
        } else {
            result = at(tree).Exec(transformExpression(tree.getExpression(), BoxingStrategy.INDIFFERENT, null));
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

    }
   
    public JCStatement transform(Tree.SpecifierStatement op) {
        // SpecifierStatement do not return any value, therefore we don't care about the type of the expressions.
        inStatement = true;
        JCStatement  result;
        HasErrorException error = errors().getFirstExpressionErrorAndMarkBrokenness(op.getBaseMemberExpression());
        if (error != null) {
            result = this.makeThrowUnresolvedCompilationError(error);
        } else if ((error = errors().getFirstExpressionErrorAndMarkBrokenness(op.getSpecifierExpression().getExpression())) != null) {
            result = this.makeThrowUnresolvedCompilationError(error);
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

            // surround the init expression with a try/catch that saves the exception
           
            String exceptionName = "x"; // doesn't matter
           
            // $initException$ = x
            JCStatement saveException = owner.make().Exec(owner.make().Assign(
                    owner.makeUnquotedIdent(Naming.getToplevelAttributeSavedExceptionName()),
                    owner.makeUnquotedIdent(exceptionName)));
            // value = null
            JCStatement nullValue = owner.make().Exec(owner.make().Assign(owner.makeUnquotedIdent(fieldName), owner.makeDefaultExprForType(this.attrType)));
            // the catch statements
            JCStatement initFlagFalse = owner.make().Exec(owner.make().Assign(
                    owner.naming.makeUnquotedIdent(Naming.getInitializationFieldName(fieldName)),
                    owner.make().Literal(false)));
            JCBlock handlerBlock = owner.make().Block(0, List.<JCTree.JCStatement>of(saveException, nullValue, initFlagFalse));
           
            // the catch block
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

            JCExpression msg = owner.make().Literal(late ? "Accessing uninitialized 'late' attribute '"+attrName+"'" : "Cyclic initialization trying to read the value of '"+attrName+"' before it was set");
            JCTree.JCThrow throwStmt = owner.make().Throw(owner.makeNewClass(owner.makeIdent(owner.syms().ceylonInitializationErrorType),
                    List.<JCExpression>of(msg)));
            List<JCStatement> catchStmts;
            if(isDeferredInitError()){
                JCStatement rethrow = owner.make().Exec(owner.utilInvocation().rethrow(
                        owner.makeUnquotedIdent(Naming.getToplevelAttributeSavedExceptionName())));
                // rethrow the init exception if we have one
                JCIf ifThrow = owner.make().If(owner.make().Binary(JCTree.NE, owner.makeUnquotedIdent(Naming.getToplevelAttributeSavedExceptionName()),
                        owner.makeNull()), rethrow, null);
                catchStmts = List.<JCTree.JCStatement>of(ifThrow, throwStmt);
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

        if (block != null) {
            stats = statementGen().transformBlock(block);
        } else {
            BoxingStrategy boxing = CodegenUtil.getBoxingStrategy(declarationModel);
            ProducedType type = declarationModel.getType();
            JCStatement transStat;
            HasErrorException error = errors().getFirstExpressionErrorAndMarkBrokenness(expression.getExpression());
            if (error != null) {
                transStat = this.makeThrowUnresolvedCompilationError(error);
            } else {
                transStat = make().Return(expressionGen().transformExpression(expression.getExpression(), boxing, type));
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

        List<JCStatement> stats;
        if (block != null) {
            stats = statementGen().transformBlock(block);
        } else {
            ProducedType type = declarationModel.getType();
            JCStatement transStmt;
            HasErrorException error = errors().getFirstExpressionErrorAndMarkBrokenness(expression.getExpression());
            if (error != null) {
                transStmt = this.makeThrowUnresolvedCompilationError(error);
            } else {
                transStmt = make().Exec(expressionGen().transformExpression(expression.getExpression(), BoxingStrategy.INDIFFERENT, type));
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

        } else {
            // We need to obtain the instance from the reference
            // but we don't need the instance to be fully deserialized
        }
        boolean requiredLookup = false;
        final JCStatement assignment;
        if (value.isToplevel() || value.isLate()) {// XXX duplicates logic in AttributeDefinitionBuilder
            // We use the setter for late values, since that will allocate
            // the array if needed.
            assignment = make().Exec(make().Apply(null,
                    naming.makeQualifiedName(naming.makeThis(), value, Naming.NA_MEMBER | Naming.NA_SETTER),
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

        return requiredLookup;
    }

    private JCStatement makeReassignFinalField(JCExpression fieldType,
            String fieldName, JCExpression newValue) {
        final JCStatement assignment;
        JCExpression mhExpr = utilInvocation().setter(
                naming.makeUnquotedIdent("lookup"),
                //naming.makeQualIdent(makeJavaType(((Class)value.getContainer()).getType(), JT_NO_PRIMITIVES), "class"),
                make().Literal(fieldName)// TODO field name should encapsulated
                );
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

                        !CodegenUtil.isUnBoxed(parameter.getModel()), BoxingStrategy.BOXED,
                        parameter.getType());
                callBuilder.argument(parameterExpr);
            }
            JCExpression expr = callBuilder.build();
            JCStatement body;
            if (isVoid(methodDecl) && Decl.isUnboxedVoid(method) && !Strategy.useBoxedVoid(method)) {
                body = make().Exec(expr);
            } else {
                expr = expressionGen().applyErasureAndBoxing(expr, paramModel.getType(), true, CodegenUtil.getBoxingStrategy(method), paramModel.getType());
                body = make().Return(expr);
View Full Code Here

Examples of com.sun.tools.javac.tree.JCTree.JCStatement

            }
           
            // A shared attribute might be initialized in a for statement, so
            // we might need a def-assignment subst for it
            List<JCAnnotation> annots = makeJavaTypeAnnotations(decl.getDeclarationModel());
            JCStatement outerSubs = statementGen().openOuterSubstitutionIfNeeded(
                    decl.getDeclarationModel(), model.getType(), annots, 0);
            if (outerSubs != null) {
                classBuilder.init(outerSubs);
            }
        }
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.