[FIR] Make annotations arguments lazy in RawFirBuilder
Sixth step for ^KT-52615
This commit is contained in:
@@ -82,6 +82,10 @@ open class RawFirBuilder(
|
||||
return file.accept(Visitor(), Unit) as FirFile
|
||||
}
|
||||
|
||||
fun buildAnnotationCall(annotation: KtAnnotationEntry): FirAnnotationCall {
|
||||
return Visitor().visitAnnotationEntry(annotation, Unit) as FirAnnotationCall
|
||||
}
|
||||
|
||||
fun buildTypeReference(reference: KtTypeReference): FirTypeRef {
|
||||
return reference.accept(Visitor(), Unit) as FirTypeRef
|
||||
}
|
||||
@@ -817,7 +821,8 @@ open class RawFirBuilder(
|
||||
val argumentList = buildArgumentList {
|
||||
source = valueArgumentList?.toFirSourceElement()
|
||||
for (argument in valueArguments) {
|
||||
val argumentExpression = disabledLazyMode { argument.toFirExpression() }
|
||||
val argumentExpression =
|
||||
buildOrLazyExpression((argument as? PsiElement)?.toFirSourceElement()) { argument.toFirExpression() }
|
||||
arguments += when (argument) {
|
||||
is KtLambdaArgument -> buildLambdaArgumentExpression {
|
||||
source = argument.toFirSourceElement()
|
||||
@@ -853,7 +858,8 @@ open class RawFirBuilder(
|
||||
}
|
||||
is KtDelegatedSuperTypeEntry -> {
|
||||
val type = superTypeListEntry.typeReference.toFirOrErrorType()
|
||||
val delegateExpression = { superTypeListEntry.delegateExpression }.toFirExpression("Should have delegate")
|
||||
val delegateExpression =
|
||||
disabledLazyMode { { superTypeListEntry.delegateExpression }.toFirExpression("Should have delegate") }
|
||||
container.superTypeRefs += type
|
||||
val delegateSource =
|
||||
superTypeListEntry.delegateExpression?.toFirSourceElement(KtFakeSourceElementKind.ClassDelegationField)
|
||||
@@ -964,7 +970,7 @@ open class RawFirBuilder(
|
||||
?: this@buildDelegatedConstructorCall.source?.fakeElement(KtFakeSourceElementKind.DelegatingConstructorCall)
|
||||
superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
}
|
||||
superTypeCallEntry?.extractArgumentsTo(this)
|
||||
disabledLazyMode { superTypeCallEntry?.extractArgumentsTo(this) }
|
||||
}
|
||||
}
|
||||
if (this == null && owner !is KtEnumEntry) {
|
||||
@@ -1693,7 +1699,7 @@ open class RawFirBuilder(
|
||||
this.superTypeRef = this@buildDelegatedConstructorCall.constructedTypeRef
|
||||
}
|
||||
}
|
||||
extractArgumentsTo(this)
|
||||
disabledLazyMode { extractArgumentsTo(this) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: annotation.kt
|
||||
@Target(AnnotationTarget#.CLASS#, AnnotationTarget#.PROPERTY#, AnnotationTarget#.LOCAL_VARIABLE#, AnnotationTarget#.VALUE_PARAMETER#, AnnotationTarget#.CONSTRUCTOR#, AnnotationTarget#.FUNCTION#, AnnotationTarget#.TYPE#) public? final? annotation class base : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class base : R|kotlin/Annotation| {
|
||||
public? constructor(): R|base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ FILE: annotationsOnNullableParenthesizedTypes.kt
|
||||
public? get(): ( @A() C?.() -> C )
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ FILE: annotationsOnParenthesizedTypes.kt
|
||||
public? get(): ( (@A() C) -> C )
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,14 +4,14 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
public? final? class B : R|kotlin/Any| {
|
||||
public? constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
public? final? class Outer : R|kotlin/Any| {
|
||||
public? constructor(): R|Outer| {
|
||||
@@ -23,7 +23,7 @@ FILE: danglingAnnotationsClassLevel.kt
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
}
|
||||
|
||||
public? final? fun withLocal(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
FILE: danglingAnnotationsFileLevel.kt
|
||||
@Suppress(String()) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
@Suppress(LAZY_EXPRESSION) @MustBeDocumented() <DANGLING MODIFIER: Top level declaration expected>
|
||||
Vendored
+2
-2
@@ -1,11 +1,11 @@
|
||||
FILE: splitModifierList.kt
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class A : R|kotlin/Annotation| {
|
||||
public? constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Target(AnnotationTarget#.TYPE#, AnnotationTarget#.TYPE_PARAMETER#) public? final? annotation class B : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) public? final? annotation class B : R|kotlin/Annotation| {
|
||||
public? constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: annotated.kt
|
||||
@Target(AnnotationTarget#.EXPRESSION#, AnnotationTarget#.LOCAL_VARIABLE#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann : R|kotlin/Annotation| {
|
||||
@Target(LAZY_EXPRESSION, LAZY_EXPRESSION) @Retention(LAZY_EXPRESSION) public? final? annotation class Ann : R|kotlin/Annotation| {
|
||||
public? constructor(): R|Ann| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -26,25 +26,25 @@ FILE: collectionLiterals.kt
|
||||
public? get(): Array<String>
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>()) @Ann2(<implicitArrayOf>()) @Ann3(<implicitArrayOf>()) public? final? class Zero : R|kotlin/Any| {
|
||||
@Ann1(LAZY_EXPRESSION) @Ann2(LAZY_EXPRESSION) @Ann3(LAZY_EXPRESSION) public? final? class Zero : R|kotlin/Any| {
|
||||
public? constructor(): R|Zero| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>(IntegerLiteral(1), IntegerLiteral(2))) public? final? class First : R|kotlin/Any| {
|
||||
@Ann1(LAZY_EXPRESSION) public? final? class First : R|kotlin/Any| {
|
||||
public? constructor(): R|First| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann2(<implicitArrayOf>(Double(3.14))) public? final? class Second : R|kotlin/Any| {
|
||||
@Ann2(LAZY_EXPRESSION) public? final? class Second : R|kotlin/Any| {
|
||||
public? constructor(): R|Second| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
@Ann3(<implicitArrayOf>(String(Alpha), String(Omega))) public? final? class Third : R|kotlin/Any| {
|
||||
@Ann3(LAZY_EXPRESSION) public? final? class Third : R|kotlin/Any| {
|
||||
public? constructor(): R|Third| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user