Add tests for element -> pseudo-value mapping
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
== test ==
|
||||
tailRecursive fun test() : Int {
|
||||
try {
|
||||
// do nothing
|
||||
} finally {
|
||||
test()
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
test <v0> NEW()
|
||||
test() <v0> COPY
|
||||
{ test() } <v0> COPY
|
||||
=====================
|
||||
@@ -0,0 +1,12 @@
|
||||
== test ==
|
||||
tailRecursive fun test() : Int {
|
||||
try {
|
||||
// do nothing
|
||||
} finally {
|
||||
return test()
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
test <v0> NEW()
|
||||
test() <v0> COPY
|
||||
=====================
|
||||
@@ -0,0 +1,25 @@
|
||||
== sum ==
|
||||
tailRecursive fun sum(x: Long, sum: Long): Long {
|
||||
if (x == 0.toLong()) return sum
|
||||
return sum(x - 1, sum + x)
|
||||
}
|
||||
---------------------
|
||||
x <v2> NEW()
|
||||
== <v5> NEW(<v2>, <v4>)
|
||||
0 <v3> NEW()
|
||||
toLong <v4> NEW(<v3>)
|
||||
toLong() <v4> COPY
|
||||
0.toLong() <v4> COPY
|
||||
x == 0.toLong() <v5> COPY
|
||||
sum <v6> NEW()
|
||||
sum <v13> NEW(<v9>, <v12>)
|
||||
x <v7> NEW()
|
||||
- <v9> NEW(<v7>, <v8>)
|
||||
1 <v8> NEW()
|
||||
x - 1 <v9> COPY
|
||||
sum <v10> NEW()
|
||||
+ <v12> NEW(<v10>, <v11>)
|
||||
x <v11> NEW()
|
||||
sum + x <v12> COPY
|
||||
sum(x - 1, sum + x) <v13> COPY
|
||||
=====================
|
||||
@@ -0,0 +1,12 @@
|
||||
== foo ==
|
||||
tailRecursive fun foo() {
|
||||
try {
|
||||
return foo()
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
foo <v0> NEW()
|
||||
foo() <v0> COPY
|
||||
=====================
|
||||
@@ -0,0 +1,23 @@
|
||||
== test ==
|
||||
fun test() : Unit {
|
||||
try {
|
||||
test()
|
||||
} catch (any : Exception) {
|
||||
test()
|
||||
} finally {
|
||||
test()
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
test <v0> NEW()
|
||||
test() <v0> COPY
|
||||
{ test() } <v0> COPY
|
||||
test <v2> NEW()
|
||||
test() <v2> COPY
|
||||
{ test() } <v2> COPY
|
||||
test <v3> NEW()
|
||||
test() <v3> COPY
|
||||
{ test() } <v3> COPY
|
||||
try { test() } catch (any : Exception) { test() } finally { test() } <v4> NEW(<v0>, <v2>)
|
||||
{ try { test() } catch (any : Exception) { test() } finally { test() } } <v4> COPY
|
||||
=====================
|
||||
Reference in New Issue
Block a user