Pseudocode: Generate instructions for superclass constructor calls. Consume value of delegate expression in the by-clause

This commit is contained in:
Alexey Sedunov
2014-06-26 20:16:08 +04:00
parent 523beab902
commit 1c75a5f642
17 changed files with 248 additions and 48 deletions
@@ -0,0 +1,60 @@
== T ==
trait T
---------------------
L0:
1 <START>
L1:
<END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== A ==
class A(a: Int, b: Int): T
---------------------
L0:
1 <START>
v(a: Int)
magic(a: Int) -> <v0>
w(a|<v0>)
v(b: Int)
magic(b: Int) -> <v1>
w(b|<v1>)
unsupported(DELEGATOR_SUPER_CLASS : T)
L1:
<END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
== B ==
class B(a: Int, b: Int): T by A(a + b, a - b)
---------------------
L0:
1 <START>
v(a: Int)
magic(a: Int) -> <v0>
w(a|<v0>)
v(b: Int)
magic(b: Int) -> <v1>
w(b|<v1>)
r(a) -> <v2>
r(b) -> <v3>
mark(a + b)
call(a + b, plus|<v2>, <v3>) -> <v4>
r(a) -> <v5>
r(b) -> <v6>
mark(a - b)
call(a - b, minus|<v5>, <v6>) -> <v7>
mark(A(a + b, a - b))
call(A(a + b, a - b), <init>|<v4>, <v7>) -> <v8>
magic(T by A(a + b, a - b)|<v8>) -> <v9>
L1:
<END> NEXT:[<SINK>]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================