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
@@ -8,26 +8,26 @@ tailRecursive fun test() : Int {
}
---------------------
L0:
<START>
mark({ try { // do nothing } finally { test() } })
1 <START>
2 mark({ try { // do nothing } finally { test() } })
mark(try { // do nothing } finally { test() })
jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ test() }), mark({ // do nothing })]
mark({ // do nothing })
3 mark({ // do nothing })
read (Unit)
jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })]
2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })]
L2 [onExceptionToFinallyBlock]:
L4 [start finally]:
mark({ test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])]
3 mark({ test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])]
mark(test())
call(test, test)
L5 [finish finally]:
jmp(error) NEXT:[<ERROR>]
2 jmp(error) NEXT:[<ERROR>]
L3 [skipFinallyToErrorBlock]:
mark({ test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])]
3 mark({ test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])]
mark(test())
call(test, test)
L1:
<END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[jmp(error)]
sink:
@@ -8,28 +8,28 @@ tailRecursive fun test() : Int {
}
---------------------
L0:
<START>
mark({ try { // do nothing } finally { return test() } })
1 <START>
2 mark({ try { // do nothing } finally { return test() } })
mark(try { // do nothing } finally { return test() })
jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ return test() }), mark({ // do nothing })]
mark({ // do nothing })
3 mark({ // do nothing })
read (Unit)
jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ return test() })]
2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ return test() })]
L2 [onExceptionToFinallyBlock]:
L4 [start finally]:
mark({ return test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])]
3 mark({ return test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])]
mark(test())
call(test, test)
ret(*) L1 NEXT:[<END>]
L5 [finish finally]:
- jmp(error) NEXT:[<ERROR>] PREV:[]
- 2 jmp(error) NEXT:[<ERROR>] PREV:[]
L3 [skipFinallyToErrorBlock]:
mark({ return test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])]
3 mark({ return test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])]
mark(test())
call(test, test)
ret(*) L1
L1:
<END> NEXT:[<SINK>] PREV:[ret(*) L1, ret(*) L1]
1 <END> NEXT:[<SINK>] PREV:[ret(*) L1, ret(*) L1]
error:
<ERROR> PREV:[]
sink:
@@ -5,12 +5,12 @@ tailRecursive fun sum(x: Long, sum: Long): Long {
}
---------------------
L0:
<START>
1 <START>
v(x: Long)
w(x)
v(sum: Long)
w(sum)
mark({ if (x == 0.toLong()) return sum return sum(x - 1, sum + x) })
2 mark({ if (x == 0.toLong()) return sum return sum(x - 1, sum + x) })
mark(if (x == 0.toLong()) return sum)
mark(x == 0.toLong())
r(x)
@@ -38,7 +38,7 @@ L3:
call(sum, sum)
ret(*) L1
L1:
<END> NEXT:[<SINK>] PREV:[ret(*) L1, ret(*) L1]
1 <END> NEXT:[<SINK>] PREV:[ret(*) L1, ret(*) L1]
error:
<ERROR> PREV:[]
sink:
@@ -8,24 +8,24 @@ tailRecursive fun foo() {
}
---------------------
L0:
<START>
mark({ try { return foo() } catch (e: Throwable) { } })
1 <START>
2 mark({ try { return foo() } catch (e: Throwable) { } })
mark(try { return foo() } catch (e: Throwable) { })
jmp?(L2 [onException]) NEXT:[v(e: Throwable), mark({ return foo() })]
mark({ return foo() })
3 mark({ return foo() })
mark(foo())
call(foo, foo)
ret(*) L1 NEXT:[<END>]
- jmp(L3 [afterCatches]) NEXT:[<END>] PREV:[]
- 2 jmp(L3 [afterCatches]) NEXT:[<END>] PREV:[]
L2 [onException]:
v(e: Throwable) PREV:[jmp?(L2 [onException])]
3 v(e: Throwable) PREV:[jmp?(L2 [onException])]
w(e)
mark({ })
4 mark({ })
read (Unit)
jmp(L3 [afterCatches])
3 jmp(L3 [afterCatches])
L1:
L3 [afterCatches]:
<END> NEXT:[<SINK>] PREV:[ret(*) L1, jmp(L3 [afterCatches])]
1 <END> NEXT:[<SINK>] PREV:[ret(*) L1, jmp(L3 [afterCatches])]
error:
<ERROR> PREV:[]
sink:
@@ -10,37 +10,37 @@ fun test() : Unit {
}
---------------------
L0:
<START>
mark({ try { test() } catch (any : Exception) { test() } finally { test() } })
1 <START>
2 mark({ try { test() } catch (any : Exception) { test() } finally { test() } })
mark(try { test() } catch (any : Exception) { test() } finally { test() })
jmp?(L2 [onException]) NEXT:[v(any : Exception), jmp?(L3 [onExceptionToFinallyBlock])]
jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ test() }), mark({ test() })]
mark({ test() })
3 mark({ test() })
mark(test())
call(test, test)
jmp(L4 [afterCatches]) NEXT:[jmp(L5 [skipFinallyToErrorBlock])]
2 jmp(L4 [afterCatches]) NEXT:[jmp(L5 [skipFinallyToErrorBlock])]
L2 [onException]:
v(any : Exception) PREV:[jmp?(L2 [onException])]
3 v(any : Exception) PREV:[jmp?(L2 [onException])]
w(any)
mark({ test() })
4 mark({ test() })
mark(test())
call(test, test)
jmp(L4 [afterCatches])
3 jmp(L4 [afterCatches])
L4 [afterCatches]:
jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches])]
2 jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches])]
L3 [onExceptionToFinallyBlock]:
L6 [start finally]:
mark({ test() }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])]
3 mark({ test() }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])]
mark(test())
call(test, test)
L7 [finish finally]:
jmp(error) NEXT:[<ERROR>]
2 jmp(error) NEXT:[<ERROR>]
L5 [skipFinallyToErrorBlock]:
mark({ test() }) PREV:[jmp(L5 [skipFinallyToErrorBlock])]
3 mark({ test() }) PREV:[jmp(L5 [skipFinallyToErrorBlock])]
mark(test())
call(test, test)
L1:
<END> NEXT:[<SINK>]
1 <END> NEXT:[<SINK>]
error:
<ERROR> PREV:[jmp(error)]
sink: