IDEA-191690 Inline method: less restrictions on tail call

This commit is contained in:
Tagir Valeev
2018-05-10 15:25:13 +07:00
parent 6b9b664629
commit 09bae6cc2b
8 changed files with 148 additions and 22 deletions
@@ -0,0 +1,16 @@
class A {
void foo() {
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
}
void bar(int x) {
if (x > 0) {
f<caret>oo();
}
System.out.println("x < 0");
}
}
@@ -0,0 +1,24 @@
class A {
void foo() {
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
}
void bar(int x) {
if (x > 0) {
f<caret>oo();
} else {
System.out.println("x < 0");
}
}
void baz(int x) {
if (x > 0)
if (x < 10) {
foo();
}
}
}
@@ -0,0 +1,25 @@
class A {
void bar(int x) {
if (x > 0) {
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
} else {
System.out.println("x < 0");
}
}
void baz(int x) {
if (x > 0)
if (x < 10) {
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
}
}
}
@@ -0,0 +1,16 @@
class A {
void foo() {
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
}
void bar(int x) {
Runnable r = () -> {
System.out.println("hi");
f<caret>oo();
};
}
}
@@ -0,0 +1,13 @@
class A {
void bar(int x) {
Runnable r = () -> {
System.out.println("hi");
if(Math.random() > 2) {
System.out.println("xyz");
return;
}
System.out.println("oops");
};
}
}