[FIR2IR] Use symbol instead of IR in Fir2IrDeclarationStorage.enter/leaveScope

^KT-60924
This commit is contained in:
Dmitriy Novozhilov
2023-08-18 13:12:13 +03:00
committed by Space Team
parent ea3378566d
commit a76c5a68f6
9 changed files with 48 additions and 57 deletions
@@ -37,7 +37,6 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.utils.addToStdlib.getOrPut
import org.jetbrains.kotlin.utils.addToStdlib.runIf import org.jetbrains.kotlin.utils.addToStdlib.runIf
import org.jetbrains.kotlin.utils.addToStdlib.runUnless import org.jetbrains.kotlin.utils.addToStdlib.runUnless
@@ -613,7 +612,7 @@ class Fir2IrClassifierStorage(
name = enumEntry.name, name = enumEntry.name,
symbol = symbol, symbol = symbol,
).apply { ).apply {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
if (irParent != null) { if (irParent != null) {
this.parent = irParent this.parent = irParent
} }
@@ -626,7 +625,7 @@ class Fir2IrClassifierStorage(
) )
this.correspondingClass = klass this.correspondingClass = klass
} }
declarationStorage.leaveScope(this) declarationStorage.leaveScope(this.symbol)
} }
} }
enumEntryCache[enumEntry] = result enumEntryCache[enumEntry] = result
@@ -218,7 +218,7 @@ class Fir2IrConverter(
// Add synthetic members *before* fake override generations. // Add synthetic members *before* fake override generations.
// Otherwise, redundant members, e.g., synthetic toString _and_ fake override toString, will be added. // Otherwise, redundant members, e.g., synthetic toString _and_ fake override toString, will be added.
if (klass is FirRegularClass && irConstructor != null && (irClass.isValue || irClass.isData)) { if (klass is FirRegularClass && irConstructor != null && (irClass.isValue || irClass.isData)) {
declarationStorage.enterScope(irConstructor) declarationStorage.enterScope(irConstructor.symbol)
val dataClassMembersGenerator = DataClassMembersGenerator(components) val dataClassMembersGenerator = DataClassMembersGenerator(components)
if (irClass.isSingleFieldValueClass) { if (irClass.isSingleFieldValueClass) {
allDeclarations += dataClassMembersGenerator.generateSingleFieldValueClassMembers(klass, irClass) allDeclarations += dataClassMembersGenerator.generateSingleFieldValueClassMembers(klass, irClass)
@@ -229,7 +229,7 @@ class Fir2IrConverter(
if (irClass.isData) { if (irClass.isData) {
allDeclarations += dataClassMembersGenerator.generateDataClassMembers(klass, irClass) allDeclarations += dataClassMembersGenerator.generateDataClassMembers(klass, irClass)
} }
declarationStorage.leaveScope(irConstructor) declarationStorage.leaveScope(irConstructor.symbol)
} }
with(fakeOverrideGenerator) { with(fakeOverrideGenerator) {
irClass.addFakeOverrides(klass, allDeclarations) irClass.addFakeOverrides(klass, allDeclarations)
@@ -245,7 +245,7 @@ class Fir2IrConverter(
): IrClass { ): IrClass {
val conversionData = codeFragment.conversionData val conversionData = codeFragment.conversionData
declarationStorage.enterScope(irClass) declarationStorage.enterScope(irClass.symbol)
val signature = irClass.symbol.signature!! val signature = irClass.symbol.signature!!
@@ -321,7 +321,7 @@ class Fir2IrConverter(
irClass.declarations.add(irPrimaryConstructor) irClass.declarations.add(irPrimaryConstructor)
irClass.declarations.add(irFragmentFunction) irClass.declarations.add(irFragmentFunction)
declarationStorage.leaveScope(irClass) declarationStorage.leaveScope(irClass.symbol)
return irClass return irClass
} }
@@ -428,7 +428,7 @@ class Fir2IrConverter(
is FirScript -> { is FirScript -> {
parent as IrFile parent as IrFile
declarationStorage.getOrCreateIrScript(declaration).also { irScript -> declarationStorage.getOrCreateIrScript(declaration).also { irScript ->
declarationStorage.enterScope(irScript) declarationStorage.enterScope(irScript.symbol)
irScript.parent = parent irScript.parent = parent
for (scriptStatement in declaration.statements) { for (scriptStatement in declaration.statements) {
when (scriptStatement) { when (scriptStatement) {
@@ -445,7 +445,7 @@ class Fir2IrConverter(
processMemberDeclaration(scriptStatement, null, irScript) processMemberDeclaration(scriptStatement, null, irScript)
} }
} }
declarationStorage.leaveScope(irScript) declarationStorage.leaveScope(irScript.symbol)
} }
} }
is FirSimpleFunction -> { is FirSimpleFunction -> {
@@ -243,14 +243,6 @@ class Fir2IrDeclarationStorage(
return fileCache[firFile]!! return fileCache[firFile]!!
} }
fun enterScope(declaration: IrDeclaration) {
enterScope(declaration.symbol)
}
fun leaveScope(declaration: IrDeclaration) {
leaveScope(declaration.symbol)
}
fun enterScope(symbol: IrSymbol) { fun enterScope(symbol: IrSymbol) {
symbolTable.enterScope(symbol) symbolTable.enterScope(symbol)
if (symbol is IrSimpleFunctionSymbol || if (symbol is IrSimpleFunctionSymbol ||
@@ -716,14 +708,14 @@ class Fir2IrDeclarationStorage(
containerSource = simpleFunction?.containerSource, containerSource = simpleFunction?.containerSource,
).apply { ).apply {
metadata = FirMetadataSource.Function(function) metadata = FirMetadataSource.Function(function)
enterScope(this) enterScope(this.symbol)
bindAndDeclareParameters( bindAndDeclareParameters(
function, irParent, function, irParent,
thisReceiverOwner, isStatic = simpleFunction?.isStatic == true, thisReceiverOwner, isStatic = simpleFunction?.isStatic == true,
forSetter = false, forSetter = false,
) )
convertAnnotationsForNonDeclaredMembers(function, origin) convertAnnotationsForNonDeclaredMembers(function, origin)
leaveScope(this) leaveScope(this.symbol)
} }
} }
result result
@@ -825,9 +817,9 @@ class Fir2IrDeclarationStorage(
// 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 constructorCache[constructor] = this
enterScope(this) enterScope(this.symbol)
bindAndDeclareParameters(constructor, irParent, irParent, isStatic = false, forSetter = false) bindAndDeclareParameters(constructor, irParent, irParent, isStatic = false, forSetter = false)
leaveScope(this) leaveScope(this.symbol)
} }
} }
} }
@@ -915,7 +907,7 @@ class Fir2IrDeclarationStorage(
} }
// NB: we should enter accessor' scope before declaring its parameters // NB: we should enter accessor' scope before declaring its parameters
// (both setter default and receiver ones, if any) // (both setter default and receiver ones, if any)
enterScope(this) enterScope(this.symbol)
if (propertyAccessor == null && isSetter) { if (propertyAccessor == null && isSetter) {
declareDefaultSetterParameter( declareDefaultSetterParameter(
property.returnTypeRef.toIrType(ConversionTypeOrigin.SETTER), property.returnTypeRef.toIrType(ConversionTypeOrigin.SETTER),
@@ -928,7 +920,7 @@ class Fir2IrDeclarationStorage(
forSetter = isSetter, forSetter = isSetter,
parentPropertyReceiver = property.receiverParameter, parentPropertyReceiver = property.receiverParameter,
) )
leaveScope(this) leaveScope(this.symbol)
if (irParent != null) { if (irParent != null) {
parent = irParent parent = irParent
} }
@@ -1114,7 +1106,7 @@ class Fir2IrDeclarationStorage(
).apply { ).apply {
metadata = FirMetadataSource.Property(property) metadata = FirMetadataSource.Property(property)
convertAnnotationsForNonDeclaredMembers(property, origin) convertAnnotationsForNonDeclaredMembers(property, origin)
enterScope(this) enterScope(this.symbol)
if (irParent != null) { if (irParent != null) {
parent = irParent parent = irParent
} }
@@ -1194,7 +1186,7 @@ class Fir2IrDeclarationStorage(
setterForPropertyCache[symbol] = it.symbol setterForPropertyCache[symbol] = it.symbol
} }
} }
leaveScope(this) leaveScope(this.symbol)
} }
} }
if (property.isFakeOverride(fakeOverrideOwnerLookupTag)) { if (property.isFakeOverride(fakeOverrideOwnerLookupTag)) {
@@ -1574,7 +1566,7 @@ class Fir2IrDeclarationStorage(
}.apply { }.apply {
parent = irParent parent = irParent
metadata = FirMetadataSource.Property(property) metadata = FirMetadataSource.Property(property)
enterScope(this) enterScope(this.symbol)
delegate = declareIrVariable( delegate = declareIrVariable(
startOffset, endOffset, IrDeclarationOrigin.PROPERTY_DELEGATE, startOffset, endOffset, IrDeclarationOrigin.PROPERTY_DELEGATE,
NameUtils.propertyDelegateName(property.name), property.delegate!!.resolvedType.toIrType(), NameUtils.propertyDelegateName(property.name), property.delegate!!.resolvedType.toIrType(),
@@ -1598,7 +1590,7 @@ class Fir2IrDeclarationStorage(
} }
} }
annotationGenerator.generate(this, property) annotationGenerator.generate(this, property)
leaveScope(this) leaveScope(this.symbol)
} }
localStorage.putDelegatedProperty(property, irProperty) localStorage.putDelegatedProperty(property, irProperty)
return irProperty return irProperty
@@ -142,7 +142,7 @@ class Fir2IrVisitor(
val irParentEnumClass = irEnumEntry.parent as? IrClass val irParentEnumClass = irEnumEntry.parent as? IrClass
// If the enum entry has its own members, we need to introduce a synthetic class. // If the enum entry has its own members, we need to introduce a synthetic class.
if (correspondingClass != null) { if (correspondingClass != null) {
declarationStorage.enterScope(irEnumEntry) declarationStorage.enterScope(irEnumEntry.symbol)
classifierStorage.putEnumEntryClassInScope(enumEntry, correspondingClass) classifierStorage.putEnumEntryClassInScope(enumEntry, correspondingClass)
val anonymousObject = (enumEntry.initializer as FirAnonymousObjectExpression).anonymousObject val anonymousObject = (enumEntry.initializer as FirAnonymousObjectExpression).anonymousObject
converter.processAnonymousObjectHeaders(anonymousObject, correspondingClass) converter.processAnonymousObjectHeaders(anonymousObject, correspondingClass)
@@ -160,7 +160,7 @@ class Fir2IrVisitor(
) )
) )
} }
declarationStorage.leaveScope(irEnumEntry) declarationStorage.leaveScope(irEnumEntry.symbol)
} else if (initializer is FirAnonymousObjectExpression) { } else if (initializer is FirAnonymousObjectExpression) {
// Otherwise, this is a default-ish enum entry, which doesn't need its own synthetic class. // Otherwise, this is a default-ish enum entry, which doesn't need its own synthetic class.
// During raw FIR building, we put the delegated constructor call inside an anonymous object. // During raw FIR building, we put the delegated constructor call inside an anonymous object.
@@ -217,7 +217,7 @@ class Fir2IrVisitor(
override fun visitScript(script: FirScript, data: Any?): IrElement { override fun visitScript(script: FirScript, data: Any?): IrElement {
return declarationStorage.getCachedIrScript(script)!!.also { irScript -> return declarationStorage.getCachedIrScript(script)!!.also { irScript ->
irScript.parent = conversionScope.parentFromStack() irScript.parent = conversionScope.parentFromStack()
declarationStorage.enterScope(irScript) declarationStorage.enterScope(irScript.symbol)
irScript.explicitCallParameters = script.parameters.map { parameter -> irScript.explicitCallParameters = script.parameters.map { parameter ->
declarationStorage.createIrVariable(parameter, irScript, givenOrigin = IrDeclarationOrigin.SCRIPT_CALL_PARAMETER) declarationStorage.createIrVariable(parameter, irScript, givenOrigin = IrDeclarationOrigin.SCRIPT_CALL_PARAMETER)
@@ -318,7 +318,7 @@ class Fir2IrVisitor(
irScript.configure(script) { declarationStorage.getCachedIrScript(it.fir)?.symbol } irScript.configure(script) { declarationStorage.getCachedIrScript(it.fir)?.symbol }
} }
} }
declarationStorage.leaveScope(irScript) declarationStorage.leaveScope(irScript.symbol)
} }
} }
@@ -326,12 +326,12 @@ class Fir2IrVisitor(
val irClass = classifierStorage.getCachedIrCodeFragment(codeFragment)!! val irClass = classifierStorage.getCachedIrCodeFragment(codeFragment)!!
val irFunction = irClass.declarations.firstIsInstance<IrSimpleFunction>() val irFunction = irClass.declarations.firstIsInstance<IrSimpleFunction>()
declarationStorage.enterScope(irFunction) declarationStorage.enterScope(irFunction.symbol)
conversionScope.withParent(irFunction) { conversionScope.withParent(irFunction) {
val irBlock = codeFragment.block.convertToIrBlock(forceUnitType = false) val irBlock = codeFragment.block.convertToIrBlock(forceUnitType = false)
irFunction.body = irFactory.createExpressionBody(irBlock) irFunction.body = irFactory.createExpressionBody(irBlock)
} }
declarationStorage.leaveScope(irFunction) declarationStorage.leaveScope(irFunction.symbol)
return irFunction return irFunction
} }
@@ -384,9 +384,9 @@ class Fir2IrVisitor(
data: Any? data: Any?
): IrElement = whileAnalysing(session, anonymousInitializer) { ): IrElement = whileAnalysing(session, anonymousInitializer) {
val irAnonymousInitializer = declarationStorage.getCachedIrAnonymousInitializer(anonymousInitializer)!! val irAnonymousInitializer = declarationStorage.getCachedIrAnonymousInitializer(anonymousInitializer)!!
declarationStorage.enterScope(irAnonymousInitializer) declarationStorage.enterScope(irAnonymousInitializer.symbol)
irAnonymousInitializer.body = convertToIrBlockBody(anonymousInitializer.body!!) irAnonymousInitializer.body = convertToIrBlockBody(anonymousInitializer.body!!)
declarationStorage.leaveScope(irAnonymousInitializer) declarationStorage.leaveScope(irAnonymousInitializer.symbol)
return irAnonymousInitializer return irAnonymousInitializer
} }
@@ -54,7 +54,7 @@ internal class ClassMemberGenerator(
private fun <T : IrDeclaration> applyParentFromStackTo(declaration: T): T = conversionScope.applyParentFromStackTo(declaration) private fun <T : IrDeclaration> applyParentFromStackTo(declaration: T): T = conversionScope.applyParentFromStackTo(declaration)
fun convertClassContent(irClass: IrClass, klass: FirClass): Unit = conversionScope.withContainingFirClass(klass) { fun convertClassContent(irClass: IrClass, klass: FirClass): Unit = conversionScope.withContainingFirClass(klass) {
declarationStorage.enterScope(irClass) declarationStorage.enterScope(irClass.symbol)
conversionScope.withClass(irClass) { conversionScope.withClass(irClass) {
val allDeclarations = buildList { val allDeclarations = buildList {
addAll(klass.declarations) addAll(klass.declarations)
@@ -68,7 +68,7 @@ internal class ClassMemberGenerator(
val irPrimaryConstructor = primaryConstructor?.let { declarationStorage.getCachedIrConstructor(it)!! } val irPrimaryConstructor = primaryConstructor?.let { declarationStorage.getCachedIrConstructor(it)!! }
if (irPrimaryConstructor != null) { if (irPrimaryConstructor != null) {
with(declarationStorage) { with(declarationStorage) {
enterScope(irPrimaryConstructor) enterScope(irPrimaryConstructor.symbol)
irPrimaryConstructor.putParametersInScope(primaryConstructor) irPrimaryConstructor.putParametersInScope(primaryConstructor)
convertFunctionContent(irPrimaryConstructor, primaryConstructor, containingClass = klass) convertFunctionContent(irPrimaryConstructor, primaryConstructor, containingClass = klass)
} }
@@ -92,10 +92,10 @@ internal class ClassMemberGenerator(
} }
annotationGenerator.generate(irClass, klass) annotationGenerator.generate(irClass, klass)
if (irPrimaryConstructor != null) { if (irPrimaryConstructor != null) {
declarationStorage.leaveScope(irPrimaryConstructor) declarationStorage.leaveScope(irPrimaryConstructor.symbol)
} }
} }
declarationStorage.leaveScope(irClass) declarationStorage.leaveScope(irClass.symbol)
} }
fun <T : IrFunction> convertFunctionContent(irFunction: T, firFunction: FirFunction?, containingClass: FirClass?): T { fun <T : IrFunction> convertFunctionContent(irFunction: T, firFunction: FirFunction?, containingClass: FirClass?): T {
@@ -104,7 +104,7 @@ internal class ClassMemberGenerator(
if (irFunction !is IrConstructor || !irFunction.isPrimary) { if (irFunction !is IrConstructor || !irFunction.isPrimary) {
// Scope for primary constructor should be entered before class declaration processing // Scope for primary constructor should be entered before class declaration processing
with(declarationStorage) { with(declarationStorage) {
enterScope(irFunction) enterScope(irFunction.symbol)
irFunction.putParametersInScope(firFunction) irFunction.putParametersInScope(firFunction)
} }
} }
@@ -194,7 +194,7 @@ internal class ClassMemberGenerator(
} }
if (firFunction != null && (irFunction !is IrConstructor || !irFunction.isPrimary)) { if (firFunction != null && (irFunction !is IrConstructor || !irFunction.isPrimary)) {
// Scope for primary constructor should be left after class declaration // Scope for primary constructor should be left after class declaration
declarationStorage.leaveScope(irFunction) declarationStorage.leaveScope(irFunction.symbol)
} }
if (irFunction is IrSimpleFunction && firFunction is FirSimpleFunction && containingClass != null) { if (irFunction is IrSimpleFunction && firFunction is FirSimpleFunction && containingClass != null) {
irFunction.overriddenSymbols = firFunction.generateOverriddenFunctionSymbols(containingClass) irFunction.overriddenSymbols = firFunction.generateOverriddenFunctionSymbols(containingClass)
@@ -241,12 +241,12 @@ internal class ClassMemberGenerator(
fun convertFieldContent(irField: IrField, field: FirField): IrField { fun convertFieldContent(irField: IrField, field: FirField): IrField {
conversionScope.withParent(irField) { conversionScope.withParent(irField) {
declarationStorage.enterScope(irField) declarationStorage.enterScope(irField.symbol)
val initializerExpression = field.initializer val initializerExpression = field.initializer
if (irField.initializer == null && initializerExpression != null) { if (irField.initializer == null && initializerExpression != null) {
irField.initializer = irFactory.createExpressionBody(visitor.convertToIrExpression(initializerExpression)) irField.initializer = irFactory.createExpressionBody(visitor.convertToIrExpression(initializerExpression))
} }
declarationStorage.leaveScope(irField) declarationStorage.leaveScope(irField.symbol)
} }
return irField return irField
} }
@@ -257,7 +257,7 @@ internal class ClassMemberGenerator(
) { ) {
val irField = backingField ?: return val irField = backingField ?: return
conversionScope.withParent(irField) { conversionScope.withParent(irField) {
declarationStorage.enterScope(this@initializeBackingField) declarationStorage.enterScope(this@initializeBackingField.symbol)
// NB: initializer can be already converted // NB: initializer can be already converted
if (initializer == null && initializerExpression != null) { if (initializer == null && initializerExpression != null) {
initializer = irFactory.createExpressionBody( initializer = irFactory.createExpressionBody(
@@ -277,7 +277,7 @@ internal class ClassMemberGenerator(
} }
) )
} }
declarationStorage.leaveScope(this@initializeBackingField) declarationStorage.leaveScope(this@initializeBackingField.symbol)
} }
property.backingField?.let { annotationGenerator.generate(irField, it) } property.backingField?.let { annotationGenerator.generate(irField, it) }
} }
@@ -296,7 +296,7 @@ internal class ClassMemberGenerator(
convertFunctionContent(this, propertyAccessor, containingClass = null) convertFunctionContent(this, propertyAccessor, containingClass = null)
if (isDefault) { if (isDefault) {
conversionScope.withParent(this) { conversionScope.withParent(this) {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
val backingField = correspondingProperty.backingField val backingField = correspondingProperty.backingField
val fieldSymbol = backingField?.symbol val fieldSymbol = backingField?.symbol
val declaration = this val declaration = this
@@ -318,7 +318,7 @@ internal class ClassMemberGenerator(
) )
) )
} }
declarationStorage.leaveScope(this) declarationStorage.leaveScope(this.symbol)
} }
} }
if (containingClass != null) { if (containingClass != null) {
@@ -108,9 +108,9 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
} }
protected fun createThisReceiverParameter(thisType: IrType, explicitReceiver: FirReceiverParameter? = null): IrValueParameter { protected fun createThisReceiverParameter(thisType: IrType, explicitReceiver: FirReceiverParameter? = null): IrValueParameter {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
return declareThisReceiverParameter(thisType, origin, explicitReceiver = explicitReceiver).apply { return declareThisReceiverParameter(thisType, origin, explicitReceiver = explicitReceiver).apply {
declarationStorage.leaveScope(this@AbstractFir2IrLazyFunction) declarationStorage.leaveScope(this@AbstractFir2IrLazyFunction.symbol)
} }
} }
@@ -84,12 +84,12 @@ class Fir2IrLazyConstructor(
val containingClass = parent as? IrClass val containingClass = parent as? IrClass
val outerClass = containingClass?.parentClassOrNull val outerClass = containingClass?.parentClassOrNull
if (containingClass?.isInner == true && outerClass != null) { if (containingClass?.isInner == true && outerClass != null) {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
declareThisReceiverParameter( declareThisReceiverParameter(
thisType = outerClass.thisReceiver!!.type, thisType = outerClass.thisReceiver!!.type,
thisOrigin = origin thisOrigin = origin
).apply { ).apply {
declarationStorage.leaveScope(this@Fir2IrLazyConstructor) declarationStorage.leaveScope(this@Fir2IrLazyConstructor.symbol)
} }
} else null } else null
} }
@@ -99,7 +99,7 @@ class Fir2IrLazyConstructor(
override var contextReceiverParametersCount: Int = fir.contextReceivers.size override var contextReceiverParametersCount: Int = fir.contextReceivers.size
override var valueParameters: List<IrValueParameter> by lazyVar(lock) { override var valueParameters: List<IrValueParameter> by lazyVar(lock) {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
buildList { buildList {
declarationStorage.addContextReceiverParametersTo( declarationStorage.addContextReceiverParametersTo(
@@ -118,7 +118,7 @@ class Fir2IrLazyConstructor(
} }
} }
}.apply { }.apply {
declarationStorage.leaveScope(this@Fir2IrLazyConstructor) declarationStorage.leaveScope(this@Fir2IrLazyConstructor.symbol)
} }
} }
@@ -77,7 +77,7 @@ class Fir2IrLazyPropertyAccessor(
override var valueParameters: List<IrValueParameter> by lazyVar(lock) { override var valueParameters: List<IrValueParameter> by lazyVar(lock) {
if (!isSetter && contextReceiverParametersCount == 0) emptyList() if (!isSetter && contextReceiverParametersCount == 0) emptyList()
else { else {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
buildList { buildList {
declarationStorage.addContextReceiverParametersTo( declarationStorage.addContextReceiverParametersTo(
@@ -103,7 +103,7 @@ class Fir2IrLazyPropertyAccessor(
) )
} }
}.apply { }.apply {
declarationStorage.leaveScope(this@Fir2IrLazyPropertyAccessor) declarationStorage.leaveScope(this@Fir2IrLazyPropertyAccessor.symbol)
} }
} }
} }
@@ -66,7 +66,7 @@ class Fir2IrLazySimpleFunction(
override var contextReceiverParametersCount: Int = fir.contextReceiversForFunctionOrContainingProperty().size override var contextReceiverParametersCount: Int = fir.contextReceiversForFunctionOrContainingProperty().size
override var valueParameters: List<IrValueParameter> by lazyVar(lock) { override var valueParameters: List<IrValueParameter> by lazyVar(lock) {
declarationStorage.enterScope(this) declarationStorage.enterScope(this.symbol)
buildList { buildList {
declarationStorage.addContextReceiverParametersTo( declarationStorage.addContextReceiverParametersTo(
@@ -83,7 +83,7 @@ class Fir2IrLazySimpleFunction(
} }
} }
}.apply { }.apply {
declarationStorage.leaveScope(this@Fir2IrLazySimpleFunction) declarationStorage.leaveScope(this@Fir2IrLazySimpleFunction.symbol)
} }
} }