Don't generate DUPX instructions for in-range-literal expressions
Store argument into a local variable instead.
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(a: Int) = a in 1 .. 10
|
||||
fun test(a: Long) = a in 1L .. 10L
|
||||
fun test(a: Float) = a in 1.0f .. 10.0f
|
||||
fun test(a: Double) = a in 1.0 .. 10.0
|
||||
fun test(a: String) = a in "abc" .. "def"
|
||||
|
||||
// 0 DUP_X1
|
||||
// 0 DUP2_X1
|
||||
// 0 DUP_X2
|
||||
// 0 DUP2_X2
|
||||
@@ -1,7 +0,0 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test(a: Long) = a in 1L .. 10L
|
||||
|
||||
// One DUP2_X2 generated for 'in' operator,
|
||||
// no DUP2_X2 generated for range on stack.
|
||||
// 1 DUP2_X2
|
||||
Reference in New Issue
Block a user