Generate singleton references as GET_OBJECT in nested classes
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
object Z {
|
||||
var counter = 0
|
||||
fun foo() {}
|
||||
|
||||
fun bar() {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
|
||||
class Nested {
|
||||
init {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
}
|
||||
|
||||
val aLambda = {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
|
||||
val anObject = object {
|
||||
init {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Z.test() {
|
||||
counter = 1
|
||||
foo()
|
||||
Z.counter = 1
|
||||
Z.foo()
|
||||
}
|
||||
Reference in New Issue
Block a user