[FIR] Refactoring: Introduce base implementations for delegating scopes
- The implementations of some FIR scopes contain a significant amount of delegation to some original scope. This pollutes the implementation of such scopes and makes them harder to read. `FirDelegatingContainingNamesAwareScope` and `FirDelegatingTypeScope` can be used as base classes which delegate by default.
This commit is contained in:
committed by
Space Team
parent
3c73331821
commit
f64cc184f4
+1
-25
@@ -329,38 +329,14 @@ internal class KtFirScopeProvider(
|
||||
private class FirTypeScopeWithSyntheticProperties(
|
||||
val typeScope: FirTypeScope,
|
||||
val syntheticPropertiesScope: FirSyntheticPropertiesScope,
|
||||
) : FirTypeScope() {
|
||||
) : FirDelegatingTypeScope(typeScope) {
|
||||
override fun getCallableNames(): Set<Name> = typeScope.getCallableNames() + syntheticPropertiesScope.getCallableNames()
|
||||
override fun getClassifierNames(): Set<Name> = typeScope.getClassifierNames()
|
||||
override fun mayContainName(name: Name): Boolean = typeScope.mayContainName(name) || syntheticPropertiesScope.mayContainName(name)
|
||||
override val scopeOwnerLookupNames: List<String> get() = typeScope.scopeOwnerLookupNames
|
||||
|
||||
override fun processDirectOverriddenFunctionsWithBaseScope(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction,
|
||||
): ProcessorAction = typeScope.processDirectOverriddenFunctionsWithBaseScope(functionSymbol, processor)
|
||||
|
||||
override fun processDirectOverriddenPropertiesWithBaseScope(
|
||||
propertySymbol: FirPropertySymbol,
|
||||
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction,
|
||||
): ProcessorAction = typeScope.processDirectOverriddenPropertiesWithBaseScope(propertySymbol, processor)
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
typeScope.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
typeScope.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
|
||||
typeScope.processPropertiesByName(name, processor)
|
||||
syntheticPropertiesScope.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
typeScope.processDeclaredConstructors(processor)
|
||||
}
|
||||
}
|
||||
|
||||
private class EnumEntryContainingNamesAwareScope(private val originalScope: FirContainingNamesAwareScope) : FirContainingNamesAwareScope() {
|
||||
|
||||
+3
-19
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticPropertyAccessor
|
||||
import org.jetbrains.kotlin.fir.java.symbols.FirJavaOverriddenSyntheticPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.nullableModuleData
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
@@ -21,23 +20,20 @@ import org.jetbrains.kotlin.name.CallableId
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.fir.declarations.resolvePhase
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingTypeScope
|
||||
|
||||
class JavaAnnotationSyntheticPropertiesScope(
|
||||
private val session: FirSession,
|
||||
owner: FirRegularClassSymbol,
|
||||
private val delegateScope: JavaClassMembersEnhancementScope
|
||||
) : FirTypeScope() {
|
||||
) : FirDelegatingTypeScope(delegateScope) {
|
||||
private val classId: ClassId = owner.classId
|
||||
private val names: Set<Name> = owner.fir.declarations.mapNotNullTo(mutableSetOf()) { (it as? FirSimpleFunction)?.name }
|
||||
private val syntheticPropertiesCache = mutableMapOf<FirNamedFunctionSymbol, FirVariableSymbol<*>>()
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
delegateScope.processDeclaredConstructors(processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
if (name in names) return
|
||||
delegateScope.processFunctionsByName(name, processor)
|
||||
super.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
|
||||
@@ -63,10 +59,6 @@ class JavaAnnotationSyntheticPropertiesScope(
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
delegateScope.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processDirectOverriddenFunctionsWithBaseScope(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
|
||||
@@ -81,14 +73,6 @@ class JavaAnnotationSyntheticPropertiesScope(
|
||||
return ProcessorAction.NONE
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> {
|
||||
return delegateScope.getCallableNames()
|
||||
}
|
||||
|
||||
override fun getClassifierNames(): Set<Name> {
|
||||
return delegateScope.getClassifierNames()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Java annotation synthetic properties scope for $classId"
|
||||
}
|
||||
|
||||
+2
-22
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
|
||||
import org.jetbrains.kotlin.fir.initialSignatureAttr
|
||||
import org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenMembers
|
||||
@@ -23,7 +23,7 @@ class JavaClassMembersEnhancementScope(
|
||||
session: FirSession,
|
||||
private val owner: FirRegularClassSymbol,
|
||||
private val useSiteMemberScope: JavaClassUseSiteMemberScope,
|
||||
) : FirTypeScope() {
|
||||
) : FirDelegatingTypeScope(useSiteMemberScope) {
|
||||
private val enhancedToOriginalFunctions = mutableMapOf<FirNamedFunctionSymbol, FirNamedFunctionSymbol>()
|
||||
private val enhancedToOriginalProperties = mutableMapOf<FirPropertySymbol, FirPropertySymbol>()
|
||||
|
||||
@@ -40,8 +40,6 @@ class JavaClassMembersEnhancementScope(
|
||||
|
||||
processor(enhancedPropertySymbol)
|
||||
}
|
||||
|
||||
return super.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
@@ -55,8 +53,6 @@ class JavaClassMembersEnhancementScope(
|
||||
processor(enhancedFunctionSymbol)
|
||||
}
|
||||
}
|
||||
|
||||
return super.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
private fun FirCallableDeclaration.overriddenMembers(): List<FirCallableDeclaration> {
|
||||
@@ -67,10 +63,6 @@ class JavaClassMembersEnhancementScope(
|
||||
}.map { it.fir }
|
||||
}
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
useSiteMemberScope.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
useSiteMemberScope.processDeclaredConstructors process@{ original ->
|
||||
val function = signatureEnhancement.enhancedFunction(original, name = null)
|
||||
@@ -109,18 +101,6 @@ class JavaClassMembersEnhancementScope(
|
||||
return useSiteMemberScope.processDirectOverriddenCallables(original, processor)
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> {
|
||||
return useSiteMemberScope.getCallableNames()
|
||||
}
|
||||
|
||||
override fun getClassifierNames(): Set<Name> {
|
||||
return useSiteMemberScope.getClassifierNames()
|
||||
}
|
||||
|
||||
override fun mayContainName(name: Name): Boolean {
|
||||
return useSiteMemberScope.mayContainName(name)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Java enhancement scope for ${owner.classId}"
|
||||
}
|
||||
|
||||
+2
-24
@@ -7,8 +7,7 @@ package org.jetbrains.kotlin.fir.java.scopes
|
||||
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
@@ -16,7 +15,7 @@ class JavaClassStaticEnhancementScope(
|
||||
session: FirSession,
|
||||
owner: FirRegularClassSymbol,
|
||||
private val useSiteStaticScope: JavaClassStaticUseSiteScope,
|
||||
) : FirContainingNamesAwareScope() {
|
||||
) : FirDelegatingContainingNamesAwareScope(useSiteStaticScope) {
|
||||
private val signatureEnhancement = FirSignatureEnhancement(owner.fir, session) {
|
||||
emptyList()
|
||||
}
|
||||
@@ -25,8 +24,6 @@ class JavaClassStaticEnhancementScope(
|
||||
useSiteStaticScope.processPropertiesByName(name) process@{ original ->
|
||||
processor(signatureEnhancement.enhancedProperty(original, name))
|
||||
}
|
||||
|
||||
return super.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
@@ -36,12 +33,6 @@ class JavaClassStaticEnhancementScope(
|
||||
processor(enhancedFunction)
|
||||
}
|
||||
}
|
||||
|
||||
return super.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
useSiteStaticScope.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
@@ -50,17 +41,4 @@ class JavaClassStaticEnhancementScope(
|
||||
processor(function as FirConstructorSymbol)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> {
|
||||
return useSiteStaticScope.getCallableNames()
|
||||
}
|
||||
|
||||
override fun getClassifierNames(): Set<Name> {
|
||||
return useSiteStaticScope.getClassifierNames()
|
||||
}
|
||||
|
||||
|
||||
override fun mayContainName(name: Name): Boolean {
|
||||
return useSiteStaticScope.mayContainName(name)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-24
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isInner
|
||||
import org.jetbrains.kotlin.fir.resolve.createSubstitutionForSupertype
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.getSingleClassifier
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.types.ConeClassLikeType
|
||||
@@ -18,35 +19,12 @@ import org.jetbrains.kotlin.name.Name
|
||||
class FirNestedClassifierScopeWithSubstitution internal constructor(
|
||||
val originalScope: FirContainingNamesAwareScope,
|
||||
private val substitutor: ConeSubstitutor
|
||||
) : FirContainingNamesAwareScope() {
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
originalScope.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
|
||||
originalScope.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
originalScope.processDeclaredConstructors(processor)
|
||||
}
|
||||
|
||||
override fun mayContainName(name: Name): Boolean {
|
||||
return originalScope.mayContainName(name)
|
||||
}
|
||||
|
||||
) : FirDelegatingContainingNamesAwareScope(originalScope) {
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
val matchedClass = originalScope.getSingleClassifier(name) as? FirRegularClassSymbol ?: return
|
||||
val substitutor = substitutor.takeIf { matchedClass.fir.isInner } ?: ConeSubstitutor.Empty
|
||||
processor(matchedClass, substitutor)
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> = originalScope.getCallableNames()
|
||||
override fun getClassifierNames(): Set<Name> = originalScope.getClassifierNames()
|
||||
|
||||
override val scopeOwnerLookupNames: List<String>
|
||||
get() = originalScope.scopeOwnerLookupNames
|
||||
}
|
||||
|
||||
fun FirContainingNamesAwareScope.wrapNestedClassifierScopeWithSubstitutionForSuperType(
|
||||
|
||||
+3
@@ -25,6 +25,9 @@ class FirOnlyCallablesScope(val delegate: FirScope) : FirScope() {
|
||||
}
|
||||
|
||||
class FirNameAwareOnlyCallablesScope(val delegate: FirContainingNamesAwareScope) : FirContainingNamesAwareScope() {
|
||||
// We want to *avoid* delegation to certain scope functions, so we delegate explicitly instead of using
|
||||
// `FirDelegatingContainingNamesAwareScope`.
|
||||
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
return delegate.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
+2
-25
@@ -8,8 +8,8 @@ package org.jetbrains.kotlin.fir.scopes.impl
|
||||
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
||||
import org.jetbrains.kotlin.fir.isIntersectionOverride
|
||||
import org.jetbrains.kotlin.fir.isSubstitutionOverride
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.scopes.FakeOverrideTypeCalculator
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
|
||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
@@ -18,11 +18,7 @@ import org.jetbrains.kotlin.name.Name
|
||||
class FirScopeWithFakeOverrideTypeCalculator(
|
||||
private val delegate: FirTypeScope,
|
||||
private val fakeOverrideTypeCalculator: FakeOverrideTypeCalculator
|
||||
) : FirTypeScope() {
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
delegate.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
) : FirDelegatingTypeScope(delegate) {
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
delegate.processFunctionsByName(name) {
|
||||
updateReturnType(it.fir)
|
||||
@@ -37,14 +33,6 @@ class FirScopeWithFakeOverrideTypeCalculator(
|
||||
}
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
delegate.processDeclaredConstructors(processor)
|
||||
}
|
||||
|
||||
override fun mayContainName(name: Name): Boolean {
|
||||
return delegate.mayContainName(name)
|
||||
}
|
||||
|
||||
override fun processDirectOverriddenFunctionsWithBaseScope(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction
|
||||
@@ -65,23 +53,12 @@ class FirScopeWithFakeOverrideTypeCalculator(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCallableNames(): Set<Name> {
|
||||
return delegate.getCallableNames()
|
||||
}
|
||||
|
||||
override fun getClassifierNames(): Set<Name> {
|
||||
return delegate.getClassifierNames()
|
||||
}
|
||||
|
||||
private fun updateReturnType(declaration: FirCallableDeclaration) {
|
||||
if (declaration.isSubstitutionOverride || declaration.isIntersectionOverride) {
|
||||
fakeOverrideTypeCalculator.computeReturnType(declaration)
|
||||
}
|
||||
}
|
||||
|
||||
override val scopeOwnerLookupNames: List<String>
|
||||
get() = delegate.scopeOwnerLookupNames
|
||||
|
||||
override fun toString(): String {
|
||||
return delegate.toString()
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class FirStaticScope(private val delegateScope: FirContainingNamesAwareScope) : FirContainingNamesAwareScope() {
|
||||
// We want to *avoid* delegation to certain scope functions, so we delegate explicitly instead of using
|
||||
// `FirDelegatingContainingNamesAwareScope`.
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||
delegateScope.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.scopes
|
||||
|
||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
/**
|
||||
* A utility [FirContainingNamesAwareScope] which delegates to [delegate] by default for the purpose of reducing boilerplate code.
|
||||
* Inheritors must override at least some functions, or else [delegate] could be used directly.
|
||||
*
|
||||
* [toString] is not delegated by default because the [delegate] is usually not the same kind of scope as this delegating scope.
|
||||
*/
|
||||
abstract class FirDelegatingContainingNamesAwareScope(private val delegate: FirContainingNamesAwareScope) : FirContainingNamesAwareScope() {
|
||||
override fun getCallableNames(): Set<Name> = delegate.getCallableNames()
|
||||
override fun getClassifierNames(): Set<Name> = delegate.getClassifierNames()
|
||||
override fun mayContainName(name: Name): Boolean = delegate.mayContainName(name)
|
||||
override val scopeOwnerLookupNames: List<String> get() = delegate.scopeOwnerLookupNames
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(
|
||||
name: Name,
|
||||
processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit,
|
||||
) {
|
||||
delegate.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(
|
||||
name: Name,
|
||||
processor: (FirNamedFunctionSymbol) -> Unit,
|
||||
) {
|
||||
delegate.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(
|
||||
name: Name,
|
||||
processor: (FirVariableSymbol<*>) -> Unit,
|
||||
) {
|
||||
delegate.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
delegate.processDeclaredConstructors(processor)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A utility [FirTypeScope] which delegates to [delegate] by default for the purpose of reducing boilerplate code. Inheritors must override
|
||||
* at least some functions, or else [delegate] could be used directly.
|
||||
*
|
||||
* [toString] is not delegated by default because the [delegate] is usually not the same kind of scope as this delegating scope.
|
||||
*/
|
||||
abstract class FirDelegatingTypeScope(private val delegate: FirTypeScope) : FirTypeScope() {
|
||||
override fun getCallableNames(): Set<Name> = delegate.getCallableNames()
|
||||
override fun getClassifierNames(): Set<Name> = delegate.getClassifierNames()
|
||||
override fun mayContainName(name: Name): Boolean = delegate.mayContainName(name)
|
||||
override val scopeOwnerLookupNames: List<String> get() = delegate.scopeOwnerLookupNames
|
||||
|
||||
override fun processClassifiersByNameWithSubstitution(
|
||||
name: Name,
|
||||
processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit,
|
||||
) {
|
||||
delegate.processClassifiersByNameWithSubstitution(name, processor)
|
||||
}
|
||||
|
||||
override fun processFunctionsByName(
|
||||
name: Name,
|
||||
processor: (FirNamedFunctionSymbol) -> Unit,
|
||||
) {
|
||||
delegate.processFunctionsByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(
|
||||
name: Name,
|
||||
processor: (FirVariableSymbol<*>) -> Unit,
|
||||
) {
|
||||
delegate.processPropertiesByName(name, processor)
|
||||
}
|
||||
|
||||
override fun processDeclaredConstructors(processor: (FirConstructorSymbol) -> Unit) {
|
||||
delegate.processDeclaredConstructors(processor)
|
||||
}
|
||||
|
||||
override fun processDirectOverriddenFunctionsWithBaseScope(
|
||||
functionSymbol: FirNamedFunctionSymbol,
|
||||
processor: (FirNamedFunctionSymbol, FirTypeScope) -> ProcessorAction,
|
||||
): ProcessorAction {
|
||||
return delegate.processDirectOverriddenFunctionsWithBaseScope(functionSymbol, processor)
|
||||
}
|
||||
|
||||
override fun processDirectOverriddenPropertiesWithBaseScope(
|
||||
propertySymbol: FirPropertySymbol,
|
||||
processor: (FirPropertySymbol, FirTypeScope) -> ProcessorAction,
|
||||
): ProcessorAction {
|
||||
return delegate.processDirectOverriddenPropertiesWithBaseScope(propertySymbol, processor)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user