[JS IR] Wrap private top level function with internal accessor stub

In case internal inline function references private top level function
after inline such function (T.L.P.) couldn't be referenced
in klib and IC cache. So create internally visible accessors for P.T.L.
function similar to what JVM backend does.

 - add box test
This commit is contained in:
Roman Artemev
2021-08-09 20:23:46 +03:00
committed by TeamCityServer
parent b3dbca7ea6
commit d3ddeef67f
11 changed files with 312 additions and 1 deletions
@@ -0,0 +1,40 @@
// MODULE: lib
// FILE: f1.kt
internal inline fun foo(): String = bar()
private fun bar(): String {
return "11"
}
class C {
internal inline fun fi(): String = bi()
private fun bi(): String = "22"
}
private fun dex(): String = "33"
class CC {
internal inline fun fx(): String = dex()
}
// FILE: f2.kt
fun test1(): String = foo()
fun test2(): String = C().fi()
fun test3(): String = CC().fx()
// MODULE: main(lib)
// FILE: m.kt
fun box(): String {
if (test1() != "11") return "FAIL 1"
if (test2() != "22") return "FAIL 2"
if (test3() != "33") return "FAIL 3"
return "OK"
}