mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-16 00:14:33 +07:00
[java] 'yield' statements support in the side-effect extractor
GitOrigin-RevId: a6020c6427a05f0bcd6f6987a13252929854c547
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c4f9d86a1c
commit
1520e434af
-14
@@ -1,14 +0,0 @@
|
||||
// "Extract side effects as an 'if' statement" "true"
|
||||
class Z {
|
||||
|
||||
void z() {
|
||||
i<caret>f (foo ? switch(0) {
|
||||
case 0: break false;
|
||||
case 1: break true;
|
||||
default: break new Foo().getBar();
|
||||
} : switch(0) {
|
||||
case 0: break false;
|
||||
case 1: break true;
|
||||
default: break false;}) {}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Extract side effects as an 'if' statement" "true"
|
||||
class Z {
|
||||
|
||||
void z() {
|
||||
i<caret>f (foo ? switch(0) {
|
||||
case 0: yield false;
|
||||
case 1: yield true;
|
||||
default: yield new Foo().getBar();
|
||||
} : switch(0) {
|
||||
case 0: yield false;
|
||||
case 1: yield true;
|
||||
default: yield false;}) {}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -6,20 +6,20 @@ class Z {
|
||||
case 0 -> false;
|
||||
case 1 -> {
|
||||
System.out.println("oops");
|
||||
break true;
|
||||
yield true;
|
||||
}
|
||||
case 2 -> {
|
||||
System.out.println("bar");
|
||||
break Math.random() > 0.5 && new Foo().getBar();
|
||||
yield Math.random() > 0.5 && new Foo().getBar();
|
||||
}
|
||||
case 3 -> {
|
||||
if(Math.random() > 0.5) break true;
|
||||
else break false;
|
||||
if(Math.random() > 0.5) yield true;
|
||||
else yield false;
|
||||
}
|
||||
case 4 -> {
|
||||
if(Math.random() > 0.5) break true;
|
||||
if(Math.random() > 0.5) yield true;
|
||||
System.out.println("four");
|
||||
break false;
|
||||
yield false;
|
||||
}
|
||||
default -> "foo"+(new Foo());
|
||||
}) {}
|
||||
Reference in New Issue
Block a user