JS: declare names for native declaration in root scope, to avoid clashing between inner names and global native names. Fix KT-14806
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
function foo() {
|
||||
return "O";
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
@native fun foo(ignore: dynamic): String
|
||||
|
||||
@JsName("foo")
|
||||
fun foo() = "K"
|
||||
|
||||
fun box() = foo(0) + foo()
|
||||
@@ -0,0 +1,6 @@
|
||||
function foo() {
|
||||
return "global foo;";
|
||||
}
|
||||
function bar() {
|
||||
return "global bar;";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
@native fun foo(): dynamic
|
||||
|
||||
@native fun bar(): dynamic
|
||||
|
||||
fun box(): String {
|
||||
val foo = "local foo;"
|
||||
val bar = "local bar;"
|
||||
val result = foo + test.bar() + test.foo() + bar
|
||||
if (result != "local foo;global bar;global foo;local bar;") return "fail: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user