[JS IR BE] Use fresh name for external JsModule declarations.
This commit is contained in:
@@ -370,7 +370,7 @@ class NameTables(
|
|||||||
declaration !is IrDeclarationWithName ->
|
declaration !is IrDeclarationWithName ->
|
||||||
return
|
return
|
||||||
|
|
||||||
declaration.isEffectivelyExternal() ->
|
declaration.isEffectivelyExternal() && (declaration.getJsModule() == null || declaration.isJsNonModule()) ->
|
||||||
globalNames.declareStableName(declaration, declaration.getJsNameOrKotlinName().identifier)
|
globalNames.declareStableName(declaration, declaration.getJsNameOrKotlinName().identifier)
|
||||||
|
|
||||||
else ->
|
else ->
|
||||||
|
|||||||
+5
@@ -4948,6 +4948,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/jsModule/externalFunction.kt");
|
runTest("js/js.translator/testData/box/jsModule/externalFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("externalFunctionNameClash.kt")
|
||||||
|
public void testExternalFunctionNameClash() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/jsModule/externalFunctionNameClash.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("externalFunctionPlain.kt")
|
@TestMetadata("externalFunctionPlain.kt")
|
||||||
public void testExternalFunctionPlain() throws Exception {
|
public void testExternalFunctionPlain() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/jsModule/externalFunctionPlain.kt");
|
runTest("js/js.translator/testData/box/jsModule/externalFunctionPlain.kt");
|
||||||
|
|||||||
+5
@@ -4963,6 +4963,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
runTest("js/js.translator/testData/box/jsModule/externalFunction.kt");
|
runTest("js/js.translator/testData/box/jsModule/externalFunction.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("externalFunctionNameClash.kt")
|
||||||
|
public void testExternalFunctionNameClash() throws Exception {
|
||||||
|
runTest("js/js.translator/testData/box/jsModule/externalFunctionNameClash.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("externalFunctionPlain.kt")
|
@TestMetadata("externalFunctionPlain.kt")
|
||||||
public void testExternalFunctionPlain() throws Exception {
|
public void testExternalFunctionPlain() throws Exception {
|
||||||
runTest("js/js.translator/testData/box/jsModule/externalFunctionPlain.kt");
|
runTest("js/js.translator/testData/box/jsModule/externalFunctionPlain.kt");
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
define("lib", [], function() {
|
||||||
|
return function(y) {
|
||||||
|
return 23 + y;
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// EXPECTED_REACHABLE_NODES: 1284
|
||||||
|
// MODULE_KIND: AMD
|
||||||
|
package foo
|
||||||
|
|
||||||
|
@JsModule("lib")
|
||||||
|
external fun foo(y: Int): Int = definedExternally
|
||||||
|
|
||||||
|
fun foo(y: String): String = y + "K"
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val foo10 = foo(10)
|
||||||
|
if (foo10 != 33) return "Fail: $foo10"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user