e6f4d6e6fa
^KT-65406
85 lines
2.0 KiB
Kotlin
Vendored
85 lines
2.0 KiB
Kotlin
Vendored
abstract class ImplicitReceiverStack : Iterable<ImplicitReceiverValue<*>> {
|
|
constructor() /* primary */ {
|
|
super/*Any*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
abstract operator fun get(name: String?): ImplicitReceiverValue<*>?
|
|
|
|
}
|
|
|
|
class ImplicitReceiverValue<S : Symbol<*>> : ReceiverValue {
|
|
val boundSymbol: S?
|
|
field = boundSymbol
|
|
get
|
|
|
|
override val type: String
|
|
field = type
|
|
override get
|
|
|
|
constructor(boundSymbol: S?, type: String) /* primary */ {
|
|
super/*Any*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class PersistentImplicitReceiverStack : ImplicitReceiverStack, Iterable<ImplicitReceiverValue<*>> {
|
|
private val stack: List<ImplicitReceiverValue<*>>
|
|
field = stack
|
|
private get
|
|
|
|
constructor(stack: List<ImplicitReceiverValue<*>>) /* primary */ {
|
|
super/*ImplicitReceiverStack*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
override operator fun get(name: String?): ImplicitReceiverValue<*>? {
|
|
return <this>.<get-stack>().lastOrNull<ImplicitReceiverValue<*>>()
|
|
}
|
|
|
|
override operator fun iterator(): Iterator<ImplicitReceiverValue<*>> {
|
|
return <this>.<get-stack>().iterator()
|
|
}
|
|
|
|
}
|
|
|
|
interface ReceiverValue {
|
|
abstract val type: String
|
|
abstract get
|
|
|
|
}
|
|
|
|
interface Symbol<E : SymbolOwner<E>> {
|
|
}
|
|
|
|
interface SymbolOwner<E : SymbolOwner<E>> {
|
|
}
|
|
|
|
fun bar(s: String) {
|
|
}
|
|
|
|
fun box(): String {
|
|
val stack: PersistentImplicitReceiverStack = PersistentImplicitReceiverStack(stack = listOf<ImplicitReceiverValue<Nothing>>(elements = [ImplicitReceiverValue<Nothing>(boundSymbol = null, type = "O"), ImplicitReceiverValue<Nothing>(boundSymbol = null, type = "K")]))
|
|
foo(stack = stack)
|
|
return stack.first<ImplicitReceiverValue<*>>().<get-type>().plus(other = { // BLOCK
|
|
val tmp_0: ImplicitReceiverValue<*>? = stack.get(name = null)
|
|
when {
|
|
EQEQ(arg0 = tmp_0, arg1 = null) -> null
|
|
else -> tmp_0.<get-type>()
|
|
}
|
|
})
|
|
}
|
|
|
|
fun foo(stack: PersistentImplicitReceiverStack) {
|
|
stack.forEach<ImplicitReceiverValue<*>>(action = local fun <anonymous>(it: ImplicitReceiverValue<*>) {
|
|
it.<get-boundSymbol>() /*~> Unit */
|
|
bar(s = it.<get-type>())
|
|
}
|
|
)
|
|
}
|
|
|