[FIR] Make annotations arguments lazy in RawFirBuilder

Fix style and typo
This commit is contained in:
Egor Kulikov
2022-12-29 14:19:31 +01:00
committed by teamcity
parent 195ecad004
commit ce262b0fb8
@@ -218,7 +218,7 @@ private data class FirLazyAnnotationTransformerData(
) )
private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTransformerData>() { private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTransformerData>() {
private val COMPILATOR_ANNOTATION_NAMES: Set<Name> = setOf( private val COMPILER_ANNOTATION_NAMES: Set<Name> = setOf(
Deprecated, Deprecated,
DeprecatedSinceKotlin, DeprecatedSinceKotlin,
WasExperimental, WasExperimental,
@@ -231,7 +231,7 @@ private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTr
if (annotationTypeRef !is FirUserTypeRef) return false if (annotationTypeRef !is FirUserTypeRef) return false
if (session.registeredPluginAnnotations.annotations.isNotEmpty()) return true if (session.registeredPluginAnnotations.annotations.isNotEmpty()) return true
val name = annotationTypeRef.qualifier.last().name val name = annotationTypeRef.qualifier.last().name
return name in COMPILATOR_ANNOTATION_NAMES return name in COMPILER_ANNOTATION_NAMES
} }
override fun <E : FirElement> transformElement(element: E, data: FirLazyAnnotationTransformerData): E { override fun <E : FirElement> transformElement(element: E, data: FirLazyAnnotationTransformerData): E {
@@ -240,11 +240,9 @@ private object FirLazyAnnotationTransformer : FirTransformer<FirLazyAnnotationTr
} }
override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: FirLazyAnnotationTransformerData): FirStatement { override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: FirLazyAnnotationTransformerData): FirStatement {
if ((data.compilerAnnotationsOnly == FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS || canBeCompilerAnnotation( val shouldCalculate = data.compilerAnnotationsOnly == FirLazyAnnotationTransformerScope.ALL_ANNOTATIONS ||
annotationCall, canBeCompilerAnnotation(annotationCall, data.session)
data.session, if (shouldCalculate && FirLazyBodiesCalculator.needCalculatingAnnotationCall(annotationCall)) {
)) && FirLazyBodiesCalculator.needCalculatingAnnotationCall(annotationCall)
) {
FirLazyBodiesCalculator.calculateLazyArgumentsForAnnotation(annotationCall, data.session) FirLazyBodiesCalculator.calculateLazyArgumentsForAnnotation(annotationCall, data.session)
} }
super.transformAnnotationCall(annotationCall, data) super.transformAnnotationCall(annotationCall, data)