< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java

Print this page

        

@@ -544,40 +544,40 @@
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
             pendingExits = new ListBuffer<>();
             scanStat(tree.body);
             alive = alive.or(resolveContinues(tree));
             scan(tree.cond);
-            alive = alive.and(!tree.cond.type.isTrue());
+            alive = alive.and(!ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue()));
             alive = alive.or(resolveBreaks(tree, prevPendingExits));
         }
 
         public void visitWhileLoop(JCWhileLoop tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
             pendingExits = new ListBuffer<>();
             scan(tree.cond);
-            alive = Liveness.from(!tree.cond.type.isFalse());
+            alive = Liveness.from(!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue()));
             scanStat(tree.body);
             alive = alive.or(resolveContinues(tree));
             alive = resolveBreaks(tree, prevPendingExits).or(
-                !tree.cond.type.isTrue());
+                !ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue()));
         }
 
         public void visitForLoop(JCForLoop tree) {
             ListBuffer<PendingExit> prevPendingExits = pendingExits;
             scanStats(tree.init);
             pendingExits = new ListBuffer<>();
             if (tree.cond != null) {
                 scan(tree.cond);
-                alive = Liveness.from(!tree.cond.type.isFalse());
+                alive = Liveness.from(!ConstFold.isFalse(tree.cond.type.getTag(), tree.cond.type.constValue()));
             } else {
                 alive = Liveness.ALIVE;
             }
             scanStat(tree.body);
             alive = alive.or(resolveContinues(tree));
             scan(tree.step);
             alive = resolveBreaks(tree, prevPendingExits).or(
-                tree.cond != null && !tree.cond.type.isTrue());
+                tree.cond != null && !ConstFold.isTrue(tree.cond.type.getTag(), tree.cond.type.constValue()));
         }
 
         public void visitForeachLoop(JCEnhancedForLoop tree) {
             visitVarDef(tree.var);
             ListBuffer<PendingExit> prevPendingExits = pendingExits;

@@ -1792,19 +1792,19 @@
 
         /** Analyze a condition. Make sure to set (un)initsWhenTrue(WhenFalse)
          *  rather than (un)inits on exit.
          */
         void scanCond(JCTree tree) {
-            if (tree.type.isFalse()) {
+            if (ConstFold.isFalse(tree.type.getTag(), tree.type.constValue())) {
                 if (inits.isReset()) merge();
                 initsWhenTrue.assign(inits);
                 initsWhenTrue.inclRange(firstadr, nextadr);
                 uninitsWhenTrue.assign(uninits);
                 uninitsWhenTrue.inclRange(firstadr, nextadr);
                 initsWhenFalse.assign(inits);
                 uninitsWhenFalse.assign(uninits);
-            } else if (tree.type.isTrue()) {
+            } else if (ConstFold.isTrue(tree.type.getTag(), tree.type.constValue())) {
                 if (inits.isReset()) merge();
                 initsWhenFalse.assign(inits);
                 initsWhenFalse.inclRange(firstadr, nextadr);
                 uninitsWhenFalse.assign(uninits);
                 uninitsWhenFalse.inclRange(firstadr, nextadr);
< prev index next >