[FIR] get rid of FirFileAnnotationsContainer

This element has been introduced to simplify resolution logic in LL FIR,
but now this element is redundant and only complicates the code as after
KT-56683 `FirFile` has real phases

^KT-65876 Fixed
This commit is contained in:
Dmitrii Gridin
2024-02-20 00:38:31 +01:00
committed by Space Team
parent 24c91bbf56
commit 17c128adf2
55 changed files with 109 additions and 484 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -36,7 +36,7 @@ object BuilderConfigurator : AbstractFirBuilderConfigurator<FirTreeBuilder>(FirT
}
builder(file) {
defaultNull("annotationsContainer")
default("symbol", "FirFileSymbol()")
}
builder(regularClass) {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -31,7 +31,6 @@ object FirTreeBuilder : AbstractFirTreeBuilder() {
val contextReceiver by element(Declaration)
val elementWithResolveState by element(Other)
val fileAnnotationsContainer by element(Other, elementWithResolveState, annotationContainer)
val declaration by sealedElement(Declaration, elementWithResolveState, annotationContainer)
val typeParameterRefsOwner by sealedElement(Declaration)
val typeParametersOwner by sealedElement(Declaration, typeParameterRefsOwner)
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -591,13 +591,6 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
noImpl(userTypeRef)
impl(file) {
default("annotations") {
value = "annotationsContainer?.annotations ?: emptyList()"
withGetter = true
}
}
noImpl(argumentList)
noImpl(annotationArgumentMapping)
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -92,10 +92,6 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
shouldBeAbstractClass()
}
fileAnnotationsContainer.configure {
+field("containingFileSymbol", type("fir.symbols.impl", "FirFileSymbol"))
}
declaration.configure {
+symbolWithPackageWithArgument("fir.symbols", "FirBasedSymbol")
+field("moduleData", firModuleDataType)
@@ -491,7 +487,6 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
}
file.configure {
+field("annotationsContainer", fileAnnotationsContainer, nullable = true).withTransform()
+field("packageDirective", packageDirective)
+fieldList(import).withTransform()
+declarations.withTransform()
@@ -70,7 +70,6 @@ internal class ImplementationPrinter(
!element.typeName.contains("Reference")
&& !element.typeName.contains("ResolvedQualifier")
&& !element.typeName.endsWith("Ref")
&& !element.typeName.endsWith("AnnotationsContainer")
}.orEmpty()
val customCalls = fieldsInConstructor.filter { it.customInitializationCall != null }