[JS IR] Implement MoveTemporaryVariableDeclarationToAssignment optimization
This commit is contained in:
committed by
Space Team
parent
25f7b81d51
commit
524c475834
@@ -0,0 +1,10 @@
|
||||
inline fun jsUpper(c: Char) = c.toString().asDynamic().toUpperCase().unsafeCast<String>()
|
||||
|
||||
inline fun upper(c: Char): Char = jsUpper(c)[0]
|
||||
|
||||
// EXPECT_GENERATED_JS: function=test expect=tempVarDeclOnAssignmentTest.js
|
||||
fun test(a: Char, b: Char): String {
|
||||
return "${upper(a)}${upper(b)}"
|
||||
}
|
||||
|
||||
fun box() = test('o', 'k')
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
function test(a, b) {
|
||||
// Inline function 'upper' call
|
||||
// Inline function 'jsUpper' call
|
||||
// Inline function 'kotlin.js.unsafeCast' call
|
||||
// Inline function 'kotlin.js.asDynamic' call
|
||||
var tmp$ret$2 = toString(a).toUpperCase();
|
||||
var tmp$ret$3 = charSequenceGet(tmp$ret$2, 0);
|
||||
var tmp = toString(tmp$ret$3);
|
||||
// Inline function 'upper' call
|
||||
// Inline function 'jsUpper' call
|
||||
// Inline function 'kotlin.js.unsafeCast' call
|
||||
// Inline function 'kotlin.js.asDynamic' call
|
||||
var tmp$ret$6 = toString(b).toUpperCase();
|
||||
var tmp$ret$7 = charSequenceGet(tmp$ret$6, 0);
|
||||
return tmp + toString(tmp$ret$7);
|
||||
}
|
||||
Reference in New Issue
Block a user