Fix bug in new JS inliner when inlining nested calls
This commit is contained in:
@@ -279,6 +279,10 @@ public class JsInliner extends JsVisitorWithContextImpl {
|
|||||||
reportInlineCycle(call, definition.getFunction());
|
reportInlineCycle(call, definition.getFunction());
|
||||||
}
|
}
|
||||||
else if (!processedFunctions.contains(definition.getFunction())) {
|
else if (!processedFunctions.contains(definition.getFunction())) {
|
||||||
|
for (int i = 0; i < call.getArguments().size(); ++i) {
|
||||||
|
JsExpression argument = call.getArguments().get(i);
|
||||||
|
call.getArguments().set(i, accept(argument));
|
||||||
|
}
|
||||||
inlineFunctionDepth++;
|
inlineFunctionDepth++;
|
||||||
visit(definition);
|
visit(definition);
|
||||||
inlineFunctionDepth--;
|
inlineFunctionDepth--;
|
||||||
|
|||||||
@@ -4856,6 +4856,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("topLevelNestedInline.kt")
|
||||||
|
public void testTopLevelNestedInline() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/topLevelNestedInline.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("typealiases.kt")
|
@TestMetadata("typealiases.kt")
|
||||||
public void testTypealiases() throws Exception {
|
public void testTypealiases() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/typealiases.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/inlineMultiModule/typealiases.kt");
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// EXPECTED_REACHABLE_NODES: 995
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib1.kt
|
||||||
|
|
||||||
|
inline fun foo() = "OK"
|
||||||
|
|
||||||
|
inline fun bar(x: String) = "($x)"
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
// CHECK_NOT_CALLED: foo
|
||||||
|
// CHECK_NOT_CALLED: bar
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (prop != "(OK)") return "fail: $prop"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
val prop = bar(foo())
|
||||||
Reference in New Issue
Block a user