Do not store null for temporary in destructuring assignment
#KT-19256 Fixed Target versions 1.1.5
This commit is contained in:
@@ -3457,10 +3457,6 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
|||||||
|
|
||||||
initializeDestructuringDeclarationVariables(multiDeclaration, initializerAsReceiver, local, asProperty);
|
initializeDestructuringDeclarationVariables(multiDeclaration, initializerAsReceiver, local, asProperty);
|
||||||
|
|
||||||
if (initializerAsmType.getSort() == Type.OBJECT || initializerAsmType.getSort() == Type.ARRAY) {
|
|
||||||
v.aconst(null);
|
|
||||||
v.store(tempVarIndex, initializerAsmType);
|
|
||||||
}
|
|
||||||
myFrameMap.leaveTemp(initializerAsmType);
|
myFrameMap.leaveTemp(initializerAsmType);
|
||||||
|
|
||||||
return StackValue.none();
|
return StackValue.none();
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
fun test(p: Pair<Int, Int>) {
|
||||||
|
val (x, y) = p
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 ACONST_NULL
|
||||||
@@ -132,6 +132,12 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("doNotStoreNullForTmpInDestructuring.kt")
|
||||||
|
public void testDoNotStoreNullForTmpInDestructuring() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/doNotStoreNullForTmpInDestructuring.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("doNotStoreNullsForCapturedVars.kt")
|
@TestMetadata("doNotStoreNullsForCapturedVars.kt")
|
||||||
public void testDoNotStoreNullsForCapturedVars() throws Exception {
|
public void testDoNotStoreNullsForCapturedVars() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/doNotStoreNullsForCapturedVars.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/bytecodeText/doNotStoreNullsForCapturedVars.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user