Control-Flow: Fix pseudocode generation for combined get/set and invoke conventions

#KT-4462 Fixed
 #KT-4681 Fixed
This commit is contained in:
Alexey Sedunov
2015-05-19 15:09:03 +03:00
parent fa29e75add
commit 868329e3cb
15 changed files with 706 additions and 10 deletions
@@ -0,0 +1,103 @@
== Bar ==
class Bar {
fun invoke(x: Int, y: Int) {}
}
---------------------
L0:
1 <START>
L1:
<END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== invoke ==
fun invoke(x: Int, y: Int) {}
---------------------
L0:
1 <START>
v(x: Int)
magic[FAKE_INITIALIZER](x: Int) -> <v0>
w(x|<v0>)
v(y: Int)
magic[FAKE_INITIALIZER](y: Int) -> <v1>
w(y|<v1>)
2 mark({})
read (Unit)
L1:
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== Foo ==
class Foo {
val set: Bar = Bar()
}
---------------------
L0:
1 <START>
v(val set: Bar = Bar())
mark(Bar())
call(Bar(), <init>) -> <v0>
w(set|<v0>)
L1:
<END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== test1 ==
fun test1(foo: Foo) {
foo[1] = 2
}
---------------------
L0:
1 <START>
v(foo: Foo)
magic[FAKE_INITIALIZER](foo: Foo) -> <v0>
w(foo|<v0>)
2 mark({ foo[1] = 2 })
mark(foo[1])
r(foo) -> <v1>
r(foo[1]|<v1>) -> <v2>
r(1) -> <v3>
r(2) -> <v4>
call(foo[1] = 2, invoke|<v2>, <v3>, <v4>) -> <v5>
L1:
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== test2 ==
fun test2(foo: Foo, set: Foo.(Int, Int) -> Int) {
foo[1] = 2
}
---------------------
L0:
1 <START>
v(foo: Foo)
magic[FAKE_INITIALIZER](foo: Foo) -> <v0>
w(foo|<v0>)
v(set: Foo.(Int, Int) -> Int)
magic[FAKE_INITIALIZER](set: Foo.(Int, Int) -> Int) -> <v1>
w(set|<v1>)
2 mark({ foo[1] = 2 })
mark(foo[1])
r(foo) -> <v2>
r(foo[1]|<v2>) -> <v3>
r(1) -> <v4>
r(2) -> <v5>
call(foo[1] = 2, invoke|<v3>, <v4>, <v5>) -> <v6>
L1:
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================