< prev index next >

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

Print this page
rev 51258 : imported patch switch.diff

*** 24,33 **** --- 24,34 ---- */ 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.
*** 337,350 **** * {@inheritDoc} This implementation scans the children in left to right order. * * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning */ @Override ! public R visitCase(CaseTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getStatements(), p, r); return r; } /** --- 338,376 ---- * {@inheritDoc} This implementation scans the children in left to right order. * * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning + * + * @deprecated + * This method is modeling switch expressions, + * which are part of a preview feature and may be removed + * if the preview feature is removed. */ @Override ! @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,450 **** * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning */ @Override public R visitBreak(BreakTree node, P p) { ! return null; } /** * {@inheritDoc} This implementation returns {@code null}. * --- 465,477 ---- * @param node {@inheritDoc} * @param p {@inheritDoc} * @return the result of scanning */ @Override + @SuppressWarnings("removal") public R visitBreak(BreakTree node, P p) { ! return scan(node.getValue(), p); } /** * {@inheritDoc} This implementation returns {@code null}. *
< prev index next >