mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8206986: Compiler support for Switch Expressions (Preview)
8207405: Compiler Tree API support for Switch Expressions (Preview) Support for switch expression, switch with rules and multiple constants for cases. Reviewed-by: jjg, mcimadamore, vromero
This commit is contained in:
parent
3f4b55c4df
commit
b3b644438e
121 changed files with 4753 additions and 268 deletions
|
@ -69,6 +69,7 @@ import javax.tools.DiagnosticListener;
|
|||
import javax.tools.JavaFileObject;
|
||||
import javax.tools.StandardJavaFileManager;
|
||||
|
||||
import com.sun.source.tree.CaseTree.CaseKind;
|
||||
import com.sun.source.tree.CompilationUnitTree;
|
||||
import com.sun.source.util.JavacTask;
|
||||
import com.sun.tools.javac.api.JavacTool;
|
||||
|
@ -76,6 +77,7 @@ import com.sun.tools.javac.code.Flags;
|
|||
import com.sun.tools.javac.tree.EndPosTable;
|
||||
import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType;
|
||||
import com.sun.tools.javac.tree.JCTree.JCCase;
|
||||
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
|
||||
import com.sun.tools.javac.tree.JCTree.JCNewClass;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
|
@ -440,6 +442,15 @@ public class TreePosTest {
|
|||
super.visitVarDef(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitCase(JCCase tree) {
|
||||
if (tree.getCaseKind() == CaseKind.RULE) {
|
||||
scan(tree.getBody());
|
||||
} else {
|
||||
super.visitCase(tree);
|
||||
}
|
||||
}
|
||||
|
||||
boolean check(Info encl, Info self) {
|
||||
if (excludeTags.size() > 0) {
|
||||
if (encl != null && excludeTags.contains(getTagName(encl.tag))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue