[IR] Fix for per-file caches support in K/N

This commit is contained in:
Igor Chevdar
2022-04-18 00:32:46 +05:00
committed by Space
parent 228141aeea
commit 7e4f94ed2c
@@ -915,7 +915,7 @@ class LocalDeclarationsLowering(
}
private fun collectLocalDeclarations() {
val enclosingFile by lazy { container.file }
val enclosingPackageFragment = container.getPackageFragment()
val enclosingClass = run {
var currentParent = container as? IrClass ?: container.parent
while (currentParent is IrDeclaration && currentParent !is IrClass) {
@@ -956,7 +956,7 @@ class LocalDeclarationsLowering(
val enclosingScope = data.currentClass
?: enclosingClass?.scopeWithCounter
// File is required for K/N because file declarations are not split by classes.
?: enclosingFile.scopeWithCounter
?: enclosingPackageFragment.scopeWithCounter
val index =
if (declaration.name.isSpecial || declaration.name in enclosingScope.usedLocalFunctionNames)
enclosingScope.counter++