JVM IR: add jvmLocalClassExtractionPhase to lift out local classes from initializers
Otherwise a local class in a field initializer or anonymous init block is copied into each constructor of the containing class (because InitializersLowering calls deepCopy). Since the code structure no longer resembles the original source code here, record a custom EnclosingMethod mapping before moving such classes, and use it in codegen.
This commit is contained in:
+5
@@ -23105,6 +23105,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/reflection/enclosing/lambdaInPackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInPropertyDelegate.kt")
|
||||
public void testLambdaInPropertyDelegate() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/enclosing/lambdaInPropertyDelegate.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInPropertyGetter.kt")
|
||||
public void testLambdaInPropertyGetter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/reflection/enclosing/lambdaInPropertyGetter.kt");
|
||||
|
||||
Reference in New Issue
Block a user