< prev index next >

src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java

Print this page
rev 51104 : imported patch switch

@@ -24,10 +24,11 @@
  */
 
 package com.sun.source.util;
 
 import com.sun.source.tree.*;
+import com.sun.source.tree.CaseTree.CaseKind;
 
 /**
  * A TreeVisitor that visits all the child tree nodes.
  * To visit nodes of a particular type, just override the
  * corresponding visitXYZ method.

@@ -339,12 +340,32 @@
      * @param node  {@inheritDoc}
      * @param p  {@inheritDoc}
      * @return the result of scanning
      */
     @Override
-    public R visitCase(CaseTree node, P p) {
+    @Deprecated(forRemoval=true, since="12")
+    @SuppressWarnings("removal")
+    public R visitSwitchExpression(SwitchExpressionTree node, P p) {
         R r = scan(node.getExpression(), p);
+        r = scanAndReduce(node.getCases(), p, r);
+        return r;
+    }
+
+    /**
+     * {@inheritDoc} This implementation scans the children in left to right order.
+     *
+     * @param node  {@inheritDoc}
+     * @param p  {@inheritDoc}
+     * @return the result of scanning
+     */
+    @Override
+    @SuppressWarnings("removal")
+    public R visitCase(CaseTree node, P p) {
+        R r = scan(node.getExpressions(), p);
+        if (node.getCaseKind() == CaseKind.RULE)
+            r = scanAndReduce(node.getBody(), p, r);
+        else
         r = scanAndReduce(node.getStatements(), p, r);
         return r;
     }
 
     /**

@@ -439,12 +460,13 @@
      * @param node  {@inheritDoc}
      * @param p  {@inheritDoc}
      * @return the result of scanning
      */
     @Override
+    @SuppressWarnings("removal")
     public R visitBreak(BreakTree node, P p) {
-        return null;
+        return scan(node.getValue(), p);
     }
 
     /**
      * {@inheritDoc} This implementation returns {@code null}.
      *
< prev index next >