FIR: Rework overridden members processing in FirTypeScope

Now, FirTypeScope returns only direct overridden and a base scope
where a client might look for deeper overridden

It's necessary to make the API fast and simple
when only direct overridden are needed

At the same time, while this API looks a bit complicated for most of the clients
there are simple extension helpers that obtain just the direct or all overridden
This commit is contained in:
Denis Zharkov
2020-08-20 10:43:29 +03:00
parent 8ce9b2d061
commit 7f3f0faa1a
14 changed files with 252 additions and 205 deletions
@@ -34,12 +34,9 @@ class JvmMappedScope(
declaredMemberScope.processFunctionsByName(name, processor)
}
// JvmMappedScope is basically used as declaration scope but it's being wrapped into substitution scopes where
// a use-site (FirOverrideAwareScope) is expected
// So, we put here a stub implementation
override fun processOverriddenFunctionsWithDepth(
override fun processDirectOverriddenFunctionsWithBaseScope(
functionSymbol: FirFunctionSymbol<*>,
processor: (FirFunctionSymbol<*>, Int) -> ProcessorAction
processor: (FirFunctionSymbol<*>, FirTypeScope) -> ProcessorAction
) = ProcessorAction.NONE
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
@@ -65,9 +62,9 @@ class JvmMappedScope(
declaredMemberScope.processPropertiesByName(name, processor)
}
override fun processOverriddenPropertiesWithDepth(
override fun processDirectOverriddenPropertiesWithBaseScope(
propertySymbol: FirPropertySymbol,
processor: (FirPropertySymbol, Int) -> ProcessorAction
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction
): ProcessorAction = ProcessorAction.NONE
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {