fix: function inlining without blocks for else statement.
This commit is contained in:
@@ -746,7 +746,7 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
|||||||
space();
|
space();
|
||||||
}
|
}
|
||||||
sourceLocationConsumer.pushSourceInfo(null);
|
sourceLocationConsumer.pushSourceInfo(null);
|
||||||
accept(elseStatement);
|
accept(materialize(elseStatement));
|
||||||
sourceLocationConsumer.popSourceInfo();
|
sourceLocationConsumer.popSourceInfo();
|
||||||
if (!elseIf) {
|
if (!elseIf) {
|
||||||
nestedPop(elseStatement);
|
nestedPop(elseStatement);
|
||||||
|
|||||||
@@ -4574,6 +4574,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/inline/astCopy.kt");
|
runTest("js/js.translator/testData/box/inline/astCopy.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("blocksMaterialization.kt")
|
||||||
|
public void testBlocksMaterialization() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/inline/blocksMaterialization.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("callFunction.kt")
|
@TestMetadata("callFunction.kt")
|
||||||
public void testCallFunction() throws Exception {
|
public void testCallFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -4952,6 +4952,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/inline/astCopy.kt");
|
runTest("js/js.translator/testData/box/inline/astCopy.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("blocksMaterialization.kt")
|
||||||
|
public void testBlocksMaterialization() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/inline/blocksMaterialization.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("callFunction.kt")
|
@TestMetadata("callFunction.kt")
|
||||||
public void testCallFunction() throws Exception {
|
public void testCallFunction() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// EXPECTED_REACHABLE_NODES: 1282
|
||||||
|
package foo
|
||||||
|
|
||||||
|
inline fun dangerCall() {
|
||||||
|
assertEquals("A", "A")
|
||||||
|
assertNotEquals("A", "A")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if ("A" != "A") dangerCall()
|
||||||
|
|
||||||
|
if ("A" == "A") {
|
||||||
|
// Nothing to do
|
||||||
|
} else dangerCall()
|
||||||
|
|
||||||
|
while ("A" != "A") dangerCall()
|
||||||
|
|
||||||
|
for (num in 0 until 0) dangerCall()
|
||||||
|
|
||||||
|
when ("A") {
|
||||||
|
"A" -> {}
|
||||||
|
else -> dangerCall()
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user