[FIR][tree] replace FirDeclaration.resolvePhase -> resolveState
Lazy resolve state represents the lazy resolve state of the current declaration It can be either resolved or be in a process of resolve ^KT-56543
This commit is contained in:
committed by
Space Team
parent
77e1bc6f9e
commit
faeafbbe29
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.fir.MutableOrEmptyList
|
||||
import org.jetbrains.kotlin.fir.builder.FirAnnotationContainerBuilder
|
||||
import org.jetbrains.kotlin.fir.builder.FirBuilderDsl
|
||||
import org.jetbrains.kotlin.fir.builder.toMutableOrEmpty
|
||||
import org.jetbrains.kotlin.fir.caches.firCachesFactory
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.builder.FirRegularClassBuilder
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
|
||||
@@ -38,8 +37,7 @@ import kotlin.properties.Delegates
|
||||
class FirJavaClass @FirImplementationDetail internal constructor(
|
||||
override val source: KtSourceElement?,
|
||||
override val moduleData: FirModuleData,
|
||||
@Volatile
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
resolvePhase: FirResolvePhase,
|
||||
override val name: Name,
|
||||
override val origin: FirDeclarationOrigin.Java,
|
||||
private val unEnhancedAnnotations: MutableOrEmptyList<JavaAnnotation>,
|
||||
@@ -62,6 +60,9 @@ class FirJavaClass @FirImplementationDetail internal constructor(
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@OptIn(ResolveStateAccess::class)
|
||||
this.resolveState = resolvePhase.asResolveState()
|
||||
}
|
||||
|
||||
override val attributes: FirDeclarationAttributes = FirDeclarationAttributes()
|
||||
@@ -86,10 +87,6 @@ class FirJavaClass @FirImplementationDetail internal constructor(
|
||||
error("${::replaceSuperTypeRefs.name} should not be called for ${this::class.simpleName}, ${superTypeRefs::class.simpleName} is lazily calulated")
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun replaceDeprecationsProvider(newDeprecationsProvider: DeprecationsProvider) {
|
||||
error("${::replaceDeprecationsProvider.name} should not be called for ${this::class.simpleName}, ${deprecationsProvider::class.simpleName} is lazily calculated")
|
||||
}
|
||||
|
||||
+5
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -40,8 +40,7 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
||||
override val typeParameters: MutableList<FirTypeParameterRef>,
|
||||
annotationBuilder: () -> List<FirAnnotation>,
|
||||
override var status: FirDeclarationStatus,
|
||||
@Volatile
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
resolvePhase: FirResolvePhase,
|
||||
override val dispatchReceiverType: ConeSimpleKotlinType?,
|
||||
) : FirConstructor() {
|
||||
override val receiverParameter: FirReceiverParameter? get() = null
|
||||
@@ -50,6 +49,9 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@OptIn(ResolveStateAccess::class)
|
||||
this.resolveState = resolvePhase.asResolveState()
|
||||
}
|
||||
|
||||
override val delegatedConstructor: FirDelegatedConstructorCall?
|
||||
@@ -77,10 +79,6 @@ class FirJavaConstructor @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
returnTypeRef.accept(visitor, data)
|
||||
controlFlowGraphReference?.accept(visitor, data)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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,8 +36,7 @@ class FirJavaField @FirImplementationDetail constructor(
|
||||
override val origin: FirDeclarationOrigin.Java,
|
||||
override val symbol: FirFieldSymbol,
|
||||
override val name: Name,
|
||||
@Volatile
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
resolvePhase: FirResolvePhase,
|
||||
override var returnTypeRef: FirTypeRef,
|
||||
override var status: FirDeclarationStatus,
|
||||
override val isVar: Boolean,
|
||||
@@ -49,6 +48,9 @@ class FirJavaField @FirImplementationDetail constructor(
|
||||
) : FirField() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@OptIn(ResolveStateAccess::class)
|
||||
this.resolveState = resolvePhase.asResolveState()
|
||||
}
|
||||
|
||||
override val receiverParameter: FirReceiverParameter? get() = null
|
||||
@@ -97,10 +99,6 @@ class FirJavaField @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {
|
||||
returnTypeRef.accept(visitor, data)
|
||||
annotations.forEach { it.accept(visitor, data) }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -49,8 +49,7 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
||||
override val source: KtSourceElement?,
|
||||
override val moduleData: FirModuleData,
|
||||
override val origin: FirDeclarationOrigin.Java,
|
||||
@Volatile
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
resolvePhase: FirResolvePhase,
|
||||
override val attributes: FirDeclarationAttributes,
|
||||
override var returnTypeRef: FirTypeRef,
|
||||
override val typeParameters: MutableList<FirTypeParameter>,
|
||||
@@ -63,6 +62,9 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
||||
) : FirSimpleFunction() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@OptIn(ResolveStateAccess::class)
|
||||
this.resolveState = resolvePhase.asResolveState()
|
||||
}
|
||||
|
||||
override val receiverParameter: FirReceiverParameter?
|
||||
@@ -152,10 +154,6 @@ class FirJavaMethod @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
|
||||
returnTypeRef = newReturnTypeRef
|
||||
}
|
||||
|
||||
+5
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -33,8 +33,7 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
||||
override val source: KtSourceElement?,
|
||||
override val moduleData: FirModuleData,
|
||||
override val origin: FirDeclarationOrigin.Java,
|
||||
@Volatile
|
||||
override var resolvePhase: FirResolvePhase,
|
||||
resolvePhase: FirResolvePhase,
|
||||
override val attributes: FirDeclarationAttributes,
|
||||
override var returnTypeRef: FirTypeRef,
|
||||
override val name: Name,
|
||||
@@ -46,6 +45,9 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
||||
) : FirValueParameter() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@OptIn(ResolveStateAccess::class)
|
||||
this.resolveState = resolvePhase.asResolveState()
|
||||
}
|
||||
|
||||
override val isCrossinline: Boolean
|
||||
@@ -163,10 +165,6 @@ class FirJavaValueParameter @FirImplementationDetail constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
override fun replaceResolvePhase(newResolvePhase: FirResolvePhase) {
|
||||
resolvePhase = newResolvePhase
|
||||
}
|
||||
|
||||
override fun replaceReturnTypeRef(newReturnTypeRef: FirTypeRef) {
|
||||
returnTypeRef = newReturnTypeRef
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.fir.declarations.resolvePhase
|
||||
|
||||
class JavaAnnotationSyntheticPropertiesScope(
|
||||
private val session: FirSession,
|
||||
|
||||
Reference in New Issue
Block a user