JS: do not create var for result if statement is 'someVar = inlineCall()'
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package foo
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=1
|
||||
|
||||
inline fun sum(x: Int, y: Int): Int {
|
||||
if (x == 0 || y == 0) return 0
|
||||
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): Int {
|
||||
val sum: Int
|
||||
sum = sum(x, y)
|
||||
return sum
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(3, test(1, 2))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package foo
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: test
|
||||
// CHECK_VARS_COUNT: function=test count=1
|
||||
|
||||
inline fun sum(x: Int, y: Int): Int {
|
||||
if (x == 0 || y == 0) return 0
|
||||
|
||||
return x + y
|
||||
}
|
||||
|
||||
fun test(x: Int, y: Int): Int {
|
||||
val sum = sum(x, y)
|
||||
return sum
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(3, test(1, 2))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user