Proper instructions for elvis operator

We should not mark elvis operator unused, for the rhs may have desired side-effects
This commit is contained in:
Andrey Breslav
2013-12-05 12:51:18 +04:00
parent 3629a539e4
commit 4ca90e9c68
8 changed files with 50 additions and 2 deletions
@@ -9,6 +9,7 @@ L0:
ret L1 NEXT:[<END>]
- jt(L2) NEXT:[r(null), <END>] PREV:[]
- r(null) PREV:[]
- r(return ?: null) PREV:[]
L1:
L2:
<END> NEXT:[<SINK>] PREV:[ret L1]
@@ -0,0 +1,23 @@
== test ==
fun test(a: Any?) {
a ?: ""
}
---------------------
L0:
<START>
v(a: Any?)
w(a)
mark({ a ?: "" })
r(a)
jt(L2) NEXT:[mark(""), <END>]
mark("")
r("")
r(a ?: "")
L1:
L2:
<END> NEXT:[<SINK>] PREV:[jt(L2), r(a ?: "")]
error:
<ERROR> PREV:[]
sink:
<SINK> PREV:[<ERROR>, <END>]
=====================
+3
View File
@@ -0,0 +1,3 @@
fun test(a: Any?) {
a ?: ""
}