FirTypeIntersectionScope: optimize/cleanup processOverriddenFunctions
This commit is contained in:
+6
-7
@@ -232,19 +232,18 @@ class FirTypeIntersectionScope private constructor(
|
|||||||
super.processClassifiersByNameWithSubstitution(name, processor)
|
super.processClassifiersByNameWithSubstitution(name, processor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
private fun getDirectOverriddenSymbols(functionSymbol: FirFunctionSymbol<*>): Collection<FirFunctionSymbol<*>> =
|
||||||
|
overriddenSymbols[functionSymbol].orEmpty() as Collection<FirFunctionSymbol<*>>
|
||||||
|
|
||||||
override fun processOverriddenFunctionsWithDepth(
|
override fun processOverriddenFunctionsWithDepth(
|
||||||
functionSymbol: FirFunctionSymbol<*>,
|
functionSymbol: FirFunctionSymbol<*>,
|
||||||
processor: (FirFunctionSymbol<*>, Int) -> ProcessorAction
|
processor: (FirFunctionSymbol<*>, Int) -> ProcessorAction
|
||||||
): ProcessorAction {
|
): ProcessorAction {
|
||||||
@Suppress("UNCHECKED_CAST")
|
for (directOverridden in getDirectOverriddenSymbols(functionSymbol)) {
|
||||||
val directOverriddenSymbols =
|
if (!processor(directOverridden, 0)) return ProcessorAction.STOP
|
||||||
overriddenSymbols[functionSymbol] as Collection<FirFunctionSymbol<*>>?
|
|
||||||
?: return ProcessorAction.NEXT
|
|
||||||
|
|
||||||
for (directOverridden in directOverriddenSymbols) {
|
|
||||||
// TODO: Preserve the scope where directOverridden came from
|
// TODO: Preserve the scope where directOverridden came from
|
||||||
for (scope in scopes) {
|
for (scope in scopes) {
|
||||||
if (!processor(directOverridden, 0)) return ProcessorAction.STOP
|
|
||||||
if (!scope.processOverriddenFunctionsWithDepth(directOverridden) { symbol, depth ->
|
if (!scope.processOverriddenFunctionsWithDepth(directOverridden) { symbol, depth ->
|
||||||
processor(symbol, depth)
|
processor(symbol, depth)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user