Use ResolvedCall for callable reference in KCallableNameProperty intrinsic

Instead of manually inspecting the DOUBLE_COLON_LHS slice, which is a
bit more error-prone. Note that new tests were passing before this
change
This commit is contained in:
Alexander Udalov
2017-11-22 18:28:21 +01:00
parent f4f5359725
commit 938fd1a57e
5 changed files with 48 additions and 17 deletions
@@ -0,0 +1,13 @@
fun box(): String {
return if (call(10, ::calc) == 5) "OK" else "fail"
}
fun calc(p: Int): Int {
return p / 2
}
inline fun call(p: Int, s: (Int) -> Int): Int {
return s(p)
}
// 0 NEW
@@ -0,0 +1,9 @@
class Foo {
fun bar(): String {
return ::bar.name
}
}
// We can avoid loading (and then immediately popping) implicit "this" when generating intrinsified bytecode for KCallable.name
// because this can't have any side effects
// 0 POP