Control-Flow: Fix pseudocode generation for combined get/set and invoke conventions
#KT-4462 Fixed #KT-4681 Fixed
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
== Bar ==
|
||||
class Bar {
|
||||
fun invoke(x: Int): Int = x
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== invoke ==
|
||||
fun invoke(x: Int): Int = x
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(x: Int)
|
||||
magic[FAKE_INITIALIZER](x: Int) -> <v0>
|
||||
w(x|<v0>)
|
||||
r(x) -> <v1>
|
||||
ret(*|<v1>) L1
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== Foo ==
|
||||
class Foo {
|
||||
val get: Bar = Bar()
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(val get: Bar = Bar())
|
||||
mark(Bar())
|
||||
call(Bar(), <init>) -> <v0>
|
||||
w(get|<v0>)
|
||||
L1:
|
||||
<END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== test1 ==
|
||||
fun test1(foo: Foo) {
|
||||
foo[1]
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(foo: Foo)
|
||||
magic[FAKE_INITIALIZER](foo: Foo) -> <v0>
|
||||
w(foo|<v0>)
|
||||
2 mark({ foo[1] })
|
||||
mark(foo[1])
|
||||
r(foo) -> <v1>
|
||||
r(foo[1]|<v1>) -> <v2>
|
||||
r(1) -> <v3>
|
||||
mark(foo[1])
|
||||
call(foo[1], invoke|<v2>, <v3>) -> <v4>
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
== test2 ==
|
||||
fun test2(foo: Foo, get: Foo.(Int) -> Int) {
|
||||
foo[1]
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
v(foo: Foo)
|
||||
magic[FAKE_INITIALIZER](foo: Foo) -> <v0>
|
||||
w(foo|<v0>)
|
||||
v(get: Foo.(Int) -> Int)
|
||||
magic[FAKE_INITIALIZER](get: Foo.(Int) -> Int) -> <v1>
|
||||
w(get|<v1>)
|
||||
2 mark({ foo[1] })
|
||||
mark(foo[1])
|
||||
r(foo) -> <v2>
|
||||
r(foo[1]|<v2>) -> <v3>
|
||||
r(1) -> <v4>
|
||||
mark(foo[1])
|
||||
call(foo[1], invoke|<v3>, <v4>) -> <v5>
|
||||
L1:
|
||||
1 <END> NEXT:[<SINK>]
|
||||
error:
|
||||
<ERROR> PREV:[]
|
||||
sink:
|
||||
<SINK> PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
Reference in New Issue
Block a user