[FIR] Replace PersistentList with MutableList in BodyResolveContext, LocalClassesNavigation
This commit is contained in:
+5
-7
@@ -73,7 +73,7 @@ class BodyResolveContext(
|
||||
get() = towerDataContextsForClassParts.towerDataContextForCallableReferences
|
||||
|
||||
@set:PrivateForInline
|
||||
var containers: PersistentList<FirDeclaration> = persistentListOf()
|
||||
var containers: MutableList<FirDeclaration> = mutableListOf()
|
||||
|
||||
@set:PrivateForInline
|
||||
var containingClass: FirRegularClass? = null
|
||||
@@ -108,25 +108,23 @@ class BodyResolveContext(
|
||||
|
||||
@PrivateForInline
|
||||
inline fun <T> withContainer(declaration: FirDeclaration, f: () -> T): T {
|
||||
val oldContainers = containers
|
||||
containers = containers.add(declaration)
|
||||
containers.add(declaration)
|
||||
return try {
|
||||
f()
|
||||
} finally {
|
||||
containers = oldContainers
|
||||
containers.removeAt(containers.size - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@PrivateForInline
|
||||
private inline fun <T> withContainerClass(declaration: FirRegularClass, f: () -> T): T {
|
||||
val oldContainers = containers
|
||||
val oldContainingClass = containingClass
|
||||
containers = containers.add(declaration)
|
||||
containers.add(declaration)
|
||||
containingClass = declaration
|
||||
return try {
|
||||
f()
|
||||
} finally {
|
||||
containers = oldContainers
|
||||
containers.removeAt(containers.size - 1)
|
||||
containingClass = oldContainingClass
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -49,7 +49,7 @@ private class NavigationInfoVisitor : FirDefaultVisitor<Unit, Any?>() {
|
||||
val resultingMap: MutableMap<FirCallableMemberDeclaration<*>, FirClassLikeDeclaration<*>> = mutableMapOf()
|
||||
val parentForClass: MutableMap<FirClassLikeDeclaration<*>, FirClassLikeDeclaration<*>?> = mutableMapOf()
|
||||
val allMembers: MutableList<FirSymbolOwner<*>> = mutableListOf()
|
||||
private var currentPath: PersistentList<FirClassLikeDeclaration<*>> = persistentListOf()
|
||||
private val currentPath: MutableList<FirClassLikeDeclaration<*>> = mutableListOf()
|
||||
|
||||
override fun visitElement(element: FirElement, data: Any?) {}
|
||||
|
||||
@@ -63,12 +63,11 @@ private class NavigationInfoVisitor : FirDefaultVisitor<Unit, Any?>() {
|
||||
|
||||
override fun <F : FirClass<F>> visitClass(klass: FirClass<F>, data: Any?) {
|
||||
parentForClass[klass] = currentPath.lastOrNull()
|
||||
val prev = currentPath
|
||||
currentPath = currentPath.add(klass)
|
||||
currentPath.add(klass)
|
||||
|
||||
klass.acceptChildren(this, null)
|
||||
|
||||
currentPath = prev
|
||||
currentPath.removeAt(currentPath.size - 1)
|
||||
}
|
||||
|
||||
override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: Any?) {
|
||||
|
||||
Reference in New Issue
Block a user