FIR2IR: Postpone binding overrides for lazy classes until sources processed
This commit is contained in:
@@ -52,6 +52,9 @@ class Fir2IrConverter(
|
||||
|
||||
private val generatorExtensions = session.extensionService.declarationGenerators
|
||||
|
||||
private var wereSourcesFakeOverridesBound = false
|
||||
private val postponedDeclarationsForFakeOverridesBinding = mutableListOf<IrDeclaration>()
|
||||
|
||||
fun runSourcesConversion(
|
||||
allFirFiles: List<FirFile>,
|
||||
irModuleFragment: IrModuleFragmentImpl,
|
||||
@@ -90,6 +93,11 @@ class Fir2IrConverter(
|
||||
for (firFile in allFirFiles) {
|
||||
bindFakeOverridesInFile(firFile)
|
||||
}
|
||||
|
||||
wereSourcesFakeOverridesBound = true
|
||||
fakeOverrideGenerator.bindOverriddenSymbols(postponedDeclarationsForFakeOverridesBinding)
|
||||
postponedDeclarationsForFakeOverridesBinding.clear()
|
||||
|
||||
// Do (3) and (4) for local classes encountered during (3)
|
||||
classifierStorage.processMembersOfClassesCreatedOnTheFly()
|
||||
|
||||
@@ -120,6 +128,15 @@ class Fir2IrConverter(
|
||||
|
||||
}
|
||||
|
||||
fun bindFakeOverridesOrPostpone(declarations: List<IrDeclaration>) {
|
||||
// Do not run binding for lazy classes until all sources declarations are processed
|
||||
if (wereSourcesFakeOverridesBound) {
|
||||
fakeOverrideGenerator.bindOverriddenSymbols(declarations)
|
||||
} else {
|
||||
postponedDeclarationsForFakeOverridesBinding += declarations
|
||||
}
|
||||
}
|
||||
|
||||
fun processLocalClassAndNestedClassesOnTheFly(regularClass: FirRegularClass, parent: IrDeclarationParent): IrClass {
|
||||
val irClass = registerClassAndNestedClasses(regularClass, parent)
|
||||
processClassAndNestedClassHeaders(regularClass)
|
||||
|
||||
@@ -141,7 +141,7 @@ class Fir2IrLazyClass(
|
||||
|
||||
fun getFakeOverridesByName(name: Name): Collection<IrDeclaration> = fakeOverridesByName.getOrPut(name) {
|
||||
fakeOverrideGenerator.generateFakeOverridesForName(this@Fir2IrLazyClass, name, fir)
|
||||
.also(fakeOverrideGenerator::bindOverriddenSymbols)
|
||||
.also(converter::bindFakeOverridesOrPostpone)
|
||||
}
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> by lazyVar(lock) {
|
||||
|
||||
+5
@@ -617,6 +617,11 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -616,6 +616,11 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -616,6 +616,11 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -591,6 +591,11 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -591,6 +591,11 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -617,6 +617,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
+5
@@ -617,6 +617,11 @@ public class IncrementalJvmOldBackendCompilerRunnerTestGenerated extends Abstrac
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/secondaryConstructorInlined/");
|
||||
}
|
||||
|
||||
@TestMetadata("serializedSubClassAndChangedInterfaces")
|
||||
public void testSerializedSubClassAndChangedInterfaces() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/serializedSubClassAndChangedInterfaces/");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleClassDependency")
|
||||
public void testSimpleClassDependency() throws Exception {
|
||||
runTest("jps-plugin/testData/incremental/pureKotlin/simpleClassDependency/");
|
||||
|
||||
Reference in New Issue
Block a user