Package com.sun.tools.javac.tree.JCTree

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


                            tryBlock = tryBlock.append(statement);
                        }

                        // Создаём тело блока finally, добавляем в него вывод затраченного времени
                        JCBlock finalizer = makePrintBlock(maker, utils, time, var);
                        JCStatement stat = maker.Try(maker.Block(0, tryBlock), List.<JCCatch>nil(), finalizer);
                        newStatements = newStatements.append(stat);

                        // Заменяем старый код метода на новый
                        processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, newStatements.toString());
                        ((JCMethodDecl) blockNode).body.stats = newStatements;
View Full Code Here


            if (innerSubst != null || innerAlias != null) {
                throw new BugException("An inner substitution (" + innerSubst + ") is already open");
            }
            try (SavedPosition pos = noPosition()) {
                innerAlias = naming.alias(value.getName());
                JCStatement result = makeVar(
                        modifiers,
                        innerAlias.getName(),
                        makeJavaType(type),
                        naming.makeName(value, Naming.NA_IDENT));
                innerSubst = naming.addVariableSubst(value, innerAlias.getName());
View Full Code Here

                        stmts));
            }
            cases.add(make().Case(null, List.of(transformElse(stmt.getSwitchCaseList()))));
           
           
            JCStatement last = make().Switch(switchExpr, cases.toList());
            last = make().Labelled(label, last);
            return last;
        }
View Full Code Here

        public JCStatement transformSwitch(SwitchStatement stmt) {
            JCExpression selectorExpr = expressionGen().transformExpression(stmt.getSwitchClause().getExpression(), BoxingStrategy.BOXED, getSwitchExpressionType(stmt));
            Naming.SyntheticName selectorAlias = naming.alias("sel");
            JCVariableDecl selector = makeVar(selectorAlias, makeJavaType(getSwitchExpressionType(stmt)), selectorExpr);
            // Make a switch out of the non-null cases
            JCStatement switch_ = new Switch().transformSwitch(stmt,
                    expressionGen().applyErasureAndBoxing(selectorAlias.makeIdent(),
                            getDefiniteSwitchExpressionType(stmt),
                            true,
                            BoxingStrategy.UNBOXED,
                            getDefiniteSwitchExpressionType(stmt)));
View Full Code Here

            return cheap;
        }
       
        @Override
        public JCStatement transformSwitch(SwitchStatement stmt) {
            JCStatement last = transformElse(stmt.getSwitchCaseList());
            final BoxingStrategy bs;
            final JCExpression selectorType;
            boolean allMatches = isSwitchAllMatchCases(stmt);
            boolean primitiveSelector = allMatches && isCeylonBasicType(getSwitchExpressionType(stmt));
            if (primitiveSelector) {
View Full Code Here

                    make().Binary(JCTree.LT, arrayIndex.makeIdent(), arrayLength.makeIdent()),
                    make().Unary(JCTree.NOT, instof));
        }
       
        // while (!(($elem$X = $V$iter$X.next()) instanceof Finished); ) {
        JCStatement whileLoop = at(node).WhileLoop(loopCond, at(node).Block(0, loopBody.toList()));
        if (label != null) {
            whileLoop = make().Labelled(label, whileLoop);
        }
        return result.append(whileLoop).toList();
    }
View Full Code Here

            List<JCAnnotation> annots = makeJavaTypeAnnotations(decl.getDeclarationModel());
           
            int modifiers = transformLocalFieldDeclFlags(decl);
            result.append(at(decl).VarDef(at(decl).Modifiers(modifiers, annots), attrName, makeJavaType(t), initialValue));
           
            JCStatement outerSubs = openOuterSubstitutionIfNeeded(
                    decl.getDeclarationModel(), t, annots, modifiers);
            if (outerSubs != null) {
                result.append(outerSubs);
            }
        }
View Full Code Here

    }

    JCStatement openOuterSubstitutionIfNeeded(
            Value value, ProducedType t,
            List<JCAnnotation> annots, int modifiers) {
        JCStatement result = null;
        if (value.isSpecifiedInForElse()) {
            DeferredSpecification d = new DeferredSpecification(value, modifiers, annots, t);
            deferredSpecifications.put(value, d);
            result = d.openOuterSubstitution();
        }
View Full Code Here

       
        // Remove the inner substitutions for any deferred values specified
        // in the control block
        closeInnerSubstituionsForSpecifiedValues(currentForClause);
       
        JCStatement brk = at(stmt).Break(getLabel(stmt));
   
        if (currentForFailVariable != null) {
            JCIdent failtest_id = at(stmt).Ident(currentForFailVariable);
            List<JCStatement> list = List.<JCStatement> of(at(stmt).Exec(at(stmt).Assign(failtest_id, make().Literal(TypeTags.BOOLEAN, 0))));
            list = list.append(brk);
View Full Code Here

                exceptionType, null);
       
        ArrayList<Tree.CatchClause> reversed = new ArrayList<Tree.CatchClause>(catchClauses);
        Collections.reverse(reversed);
       
        JCStatement elsePart = make().Throw(exceptionVar.makeIdent());
       
        for (Tree.CatchClause catchClause : reversed) {
            Tree.Variable caughtVar = catchClause.getCatchVariable().getVariable();
            ProducedType caughtType = caughtVar.getType().getTypeModel();
            List<JCStatement> catchBlock = transformBlock(catchClause.getBlock());
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.tree.JCTree.JCStatement

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.