[FIR2IR] Extract logic of IR declarations generation into separate component. Part 5
Move caching of created IrConstructor back to Fir2IrDeclarationStorage ^KT-61513
This commit is contained in:
committed by
Space Team
parent
6621b16e77
commit
e83dc35ba5
@@ -509,6 +509,11 @@ class Fir2IrDeclarationStorage(
|
|||||||
return callablesGenerator.createIrConstructor(constructor, irParent, predefinedOrigin, isLocal)
|
return callablesGenerator.createIrConstructor(constructor, irParent, predefinedOrigin, isLocal)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@LeakedDeclarationCaches
|
||||||
|
internal fun cacheIrConstructor(constructor: FirConstructor, irConstructor: IrConstructor) {
|
||||||
|
constructorCache[constructor] = irConstructor
|
||||||
|
}
|
||||||
|
|
||||||
fun getOrCreateIrProperty(
|
fun getOrCreateIrProperty(
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
irParent: IrDeclarationParent?,
|
irParent: IrDeclarationParent?,
|
||||||
@@ -1068,3 +1073,10 @@ internal fun FirCallableDeclaration.isFakeOverride(fakeOverrideOwnerLookupTag: C
|
|||||||
private object IsStubPropertyForPureFieldKey : FirDeclarationDataKey()
|
private object IsStubPropertyForPureFieldKey : FirDeclarationDataKey()
|
||||||
|
|
||||||
internal var FirProperty.isStubPropertyForPureField: Boolean? by FirDeclarationDataRegistry.data(IsStubPropertyForPureFieldKey)
|
internal var FirProperty.isStubPropertyForPureField: Boolean? by FirDeclarationDataRegistry.data(IsStubPropertyForPureFieldKey)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opt-in to this annotation indicates that some code uses annotated function but it actually shouldn't
|
||||||
|
* See KT-61513
|
||||||
|
*/
|
||||||
|
@RequiresOptIn
|
||||||
|
annotation class LeakedDeclarationCaches
|
||||||
|
|||||||
+2
-1
@@ -410,7 +410,8 @@ class Fir2IrCallableDeclarationsGenerator(val components: Fir2IrComponents) : Fi
|
|||||||
metadata = FirMetadataSource.Function(constructor)
|
metadata = FirMetadataSource.Function(constructor)
|
||||||
// Add to cache before generating parameters to prevent an infinite loop when an annotation value parameter is annotated
|
// Add to cache before generating parameters to prevent an infinite loop when an annotation value parameter is annotated
|
||||||
// with the annotation itself.
|
// with the annotation itself.
|
||||||
constructorCache[constructor] = this
|
@OptIn(LeakedDeclarationCaches::class)
|
||||||
|
declarationStorage.cacheIrConstructor(constructor, this)
|
||||||
declarationStorage.withScope(symbol) {
|
declarationStorage.withScope(symbol) {
|
||||||
setAndModifyParent(this, irParent)
|
setAndModifyParent(this, irParent)
|
||||||
declareParameters(constructor, irParent, dispatchReceiverType = null, isStatic = false, forSetter = false)
|
declareParameters(constructor, irParent, dispatchReceiverType = null, isStatic = false, forSetter = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user