[FIR] Make FirFile.annotationsContainer nullable
Previously, when no file annotations were present, the FIR element didn't have a source. By making it nullable, it will only be created when appropriate and the source will never be null. #KT-55835
This commit is contained in:
committed by
Space Team
parent
311975f1ed
commit
bed6cb7154
+4
@@ -41,6 +41,10 @@ object BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>(FirTree
|
||||
fields from klass without listOf("symbol", "resolvePhase", "resolveState", "controlFlowGraphReference")
|
||||
}
|
||||
|
||||
builder(file) {
|
||||
defaultNull("annotationsContainer")
|
||||
}
|
||||
|
||||
builder(regularClass) {
|
||||
parents += classBuilder
|
||||
parents += typeParameterRefsOwnerBuilder
|
||||
|
||||
+1
-1
@@ -609,7 +609,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
|
||||
impl(file) {
|
||||
default("annotations") {
|
||||
value = "annotationsContainer.annotations"
|
||||
value = "annotationsContainer?.annotations ?: emptyList()"
|
||||
withGetter = true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -477,7 +477,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
}
|
||||
|
||||
file.configure {
|
||||
+field("annotationsContainer", fileAnnotationsContainer).withTransform()
|
||||
+field("annotationsContainer", fileAnnotationsContainer, nullable = true).withTransform()
|
||||
+field("packageDirective", packageDirective)
|
||||
+fieldList(import).withTransform()
|
||||
+declarations.withTransform()
|
||||
|
||||
Reference in New Issue
Block a user