FIR: make both ImplicitReceiverStack.get implementations consistent

This commit is contained in:
Mikhail Glukhikh
2020-05-06 12:18:47 +03:00
parent cd2f5895a6
commit b058ca635c
@@ -43,8 +43,14 @@ class PersistentImplicitReceiverStack private constructor(
}
override operator fun get(name: String?): ImplicitReceiverValue<*>? {
if (name == null) return stack.lastOrNull()
return indexesPerLabel[Name.identifier(name)].lastOrNull()?.let { stack[it] }
if (name == null) {
return stack.lastOrNull {
it !is ImplicitDispatchReceiverValue || !it.inDelegated
}
}
return indexesPerLabel[Name.identifier(name)].lastOrNull()?.let { stack[it] }?.takeIf {
it !is ImplicitDispatchReceiverValue || !it.inDelegated
}
}
override fun lastDispatchReceiver(): ImplicitDispatchReceiverValue? {