79d378f2bd
The patch adopts and reuses the optimizations from the legacy backend. The optimizations remove useless temporary variables, statements and simplify generated JS code. The optimizations can be disabled by `-Xoptimize-generated-js=false`. Related to KT-51139
34 lines
539 B
Kotlin
Vendored
34 lines
539 B
Kotlin
Vendored
// FILE: test.kt
|
|
inline fun foo(stringMaker: () -> String = { "OK" }): String {
|
|
return stringMaker()
|
|
}
|
|
|
|
inline fun foo2(stringMaker: () -> String = {
|
|
"OK"
|
|
// Comment
|
|
}): String {
|
|
return stringMaker()
|
|
}
|
|
|
|
fun box(): String {
|
|
foo()
|
|
foo2()
|
|
return "OK"
|
|
}
|
|
|
|
// EXPECTATIONS JVM JVM_IR
|
|
// test.kt:14 box
|
|
// test.kt:2 box
|
|
// test.kt:3 box
|
|
// test.kt:2 box
|
|
// test.kt:3 box
|
|
// test.kt:15 box
|
|
// test.kt:6 box
|
|
// test.kt:10 box
|
|
// test.kt:7 box
|
|
// test.kt:10 box
|
|
// test.kt:16 box
|
|
|
|
// EXPECTATIONS JS_IR
|
|
// test.kt:16 box
|