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
@@ -2,7 +2,15 @@ fun box(): String {
var state = 0
val name = (state++)::toString.name
if (name != "toString") return "Fail 1: $name"
if (state != 1) return "Fail 2: $state"
val name2 = with(state++) {
::toString.name
::toString.name
::toString.name
}
if (name2 != "toString") return "Fail 2: $name2"
if (state != 2) return "Fail 3: $state"
return "OK"
}
@@ -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