fix(KT-49225): remove unnecessery boxing.
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ class ExportedDefaultParameterStub(val context: JsIrBackendContext) : Declaratio
|
||||
irIfThenElse(
|
||||
toParameter.type,
|
||||
irEqeqeq(
|
||||
irGet(toParameter),
|
||||
irGet(toParameter, context.irBuiltIns.anyNType),
|
||||
irCall(this@ExportedDefaultParameterStub.context.intrinsics.jsUndefined)
|
||||
),
|
||||
defaultValue.expression,
|
||||
|
||||
@@ -128,6 +128,8 @@ fun IrBuilderWithScope.irGet(type: IrType, variable: IrValueSymbol) =
|
||||
|
||||
fun IrBuilderWithScope.irGet(variable: IrValueDeclaration) = irGet(variable.type, variable.symbol)
|
||||
|
||||
fun IrBuilderWithScope.irGet(variable: IrValueDeclaration, type: IrType) = irGet(type, variable.symbol)
|
||||
|
||||
fun IrBuilderWithScope.irSet(variable: IrValueSymbol, value: IrExpression, origin: IrStatementOrigin = IrStatementOrigin.EQ) =
|
||||
IrSetValueImpl(startOffset, endOffset, context.irBuiltIns.unitType, variable, value, origin)
|
||||
|
||||
|
||||
Generated
+5
@@ -2110,6 +2110,11 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultInlineClassConstructorParam.kt")
|
||||
public void testDefaultInlineClassConstructorParam() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
|
||||
|
||||
+5
@@ -2105,6 +2105,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultInlineClassConstructorParam.kt")
|
||||
public void testDefaultInlineClassConstructorParam() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
|
||||
|
||||
+5
@@ -1780,6 +1780,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/export"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultInlineClassConstructorParam.kt")
|
||||
public void testDefaultInlineClassConstructorParam() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/defaultInlineClassConstructorParam.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("exportAllFile.kt")
|
||||
public void testExportAllFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportAllFile.kt");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// KT-49225
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
value class Koo(val koo: String = "OK")
|
||||
|
||||
@JsExport
|
||||
class Bar(val koo: Koo = Koo())
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.js
|
||||
function box() {
|
||||
return new main.Bar().koo;
|
||||
}
|
||||
Reference in New Issue
Block a user