JVM_IR: optimize delegation by property references
E.g. a statement like
var x by ::y
is semantically equivalent to
var x
get() = y
set(value) { y = value }
and thus does not need a full property reference object, or even a field
if the receiver is not bound.
#KT-39054 Fixed
#KT-47102 Fixed
This commit is contained in:
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -9541,6 +9541,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateToAnotherMutable.kt")
|
||||
public void testDelegateToAnotherMutable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateWithPrivateSet.kt")
|
||||
public void testDelegateWithPrivateSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt");
|
||||
|
||||
Generated
+5
@@ -8947,6 +8947,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateToAnotherMutable.kt")
|
||||
public void testDelegateToAnotherMutable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateWithPrivateSet.kt")
|
||||
public void testDelegateWithPrivateSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt");
|
||||
|
||||
Generated
+5
@@ -8947,6 +8947,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateToAnotherMutable.kt")
|
||||
public void testDelegateToAnotherMutable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateWithPrivateSet.kt")
|
||||
public void testDelegateWithPrivateSet() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt");
|
||||
|
||||
Reference in New Issue
Block a user