[JS IR BE] Implement property reference

Add cache for direct (which has no closured parameters) KCallable references
Refactor FunctionReferenceLowering
 * Rename FunctionReferenceLowering -> CallableReferenceLowering
 * Add util method to create value parameters
This commit is contained in:
Roman Artemev
2018-05-14 18:50:57 +03:00
committed by Roman Artemev
parent fb1fbf1473
commit 261edd5f4c
17 changed files with 546 additions and 257 deletions
@@ -0,0 +1,24 @@
// EXPECTED_REACHABLE_NODES: 1109
// This test was adapted from compiler/testData/codegen/box/callableReference/function/local/.
package foo
import kotlin.reflect.KFunction
fun foo0() = "OK"
fun foo1(a: String) = "O" + a
fun foo2(a: String, b: String) = a + b
fun refName0(ref: KFunction<String>) = ref.name
//fun refName1(ref: KFunction1<String, String>) = ref.name
//fun refName2(ref: KFunction2<String, String, String>) = ref.name
fun box(): String {
val name = refName0(::foo0)
val f1 = ::foo1
val f2 = ::foo2
if (name != "foo0") return "Fail: " + name
if (f1.name != "foo1") return "Fail: " + f1.name
if (f2.name != "foo2") return "Fail: " + f2.name
return "OK"
}