Added/updated tests for LexicalScope.

This commit is contained in:
Svetlana Isakova
2014-03-05 19:32:10 +04:00
parent 2cfcd1783b
commit 006f3ccbe9
81 changed files with 1404 additions and 604 deletions
@@ -0,0 +1,53 @@
== foo ==
fun foo() {
"before"
val b = 1
fun local(x: Int) {
val a = x + b
}
"after"
}
---------------------
L0:
1 <START> INIT: in: {} out: {}
2 mark({ "before" val b = 1 fun local(x: Int) { val a = x + b } "after" })
mark("before")
r("before")
v(val b = 1) INIT: in: {} out: {b=D}
r(1) INIT: in: {b=D} out: {b=D}
w(b) INIT: in: {b=D} out: {b=ID}
jmp?(L2) INIT: in: {b=ID} out: {b=ID}
d(fun local(x: Int) { val a = x + b }) INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
L2:
mark("after") INIT: in: {b=ID} out: {b=ID}
r("after")
L1:
1 <END>
error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {}
=====================
== local ==
fun local(x: Int) {
val a = x + b
}
---------------------
L3:
3 <START> INIT: in: {b=ID} out: {b=ID}
v(x: Int) INIT: in: {b=ID} out: {b=ID, x=D}
w(x) INIT: in: {b=ID, x=D} out: {b=ID, x=ID}
4 mark({ val a = x + b }) INIT: in: {b=ID, x=ID} out: {b=ID, x=ID}
v(val a = x + b) INIT: in: {b=ID, x=ID} out: {a=D, b=ID, x=ID}
mark(x + b) INIT: in: {a=D, b=ID, x=ID} out: {a=D, b=ID, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ}
r(x) USE: in: {b=READ} out: {b=READ, x=READ}
r(b) USE: in: {} out: {b=READ}
call(+, plus)
w(a) INIT: in: {a=D, b=ID, x=ID} out: {a=ID, b=ID, x=ID}
L4:
3 <END> INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID}
error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {}
=====================