FIR: make FirOnlyClassifiersScope/FirOnlyCallablesScope to be name aware

This commit is contained in:
Ilya Kirillov
2021-05-15 23:43:42 +02:00
committed by TeamCityServer
parent fcc5af99f3
commit 6b450e6fdf
3 changed files with 16 additions and 2 deletions
@@ -5,12 +5,14 @@
package org.jetbrains.kotlin.fir.scopes.impl
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
import org.jetbrains.kotlin.fir.scopes.FirScope
import org.jetbrains.kotlin.fir.scopes.getContainingCallableNamesIfPresent
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
import org.jetbrains.kotlin.name.Name
class FirOnlyCallablesScope(val delegate: FirScope) : FirScope() {
class FirOnlyCallablesScope(val delegate: FirScope) : FirScope(), FirContainingNamesAwareScope {
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
return delegate.processFunctionsByName(name, processor)
}
@@ -21,4 +23,8 @@ class FirOnlyCallablesScope(val delegate: FirScope) : FirScope() {
override val scopeOwnerLookupNames: List<String>
get() = delegate.scopeOwnerLookupNames
override fun getCallableNames(): Set<Name> = delegate.getContainingCallableNamesIfPresent()
override fun getClassifierNames(): Set<Name> = emptySet()
}
@@ -6,12 +6,19 @@
package org.jetbrains.kotlin.fir.scopes.impl
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
import org.jetbrains.kotlin.fir.scopes.FirScope
import org.jetbrains.kotlin.fir.scopes.getContainingCallableNamesIfPresent
import org.jetbrains.kotlin.fir.scopes.getContainingClassifierNamesIfPresent
import org.jetbrains.kotlin.fir.symbols.impl.FirClassifierSymbol
import org.jetbrains.kotlin.name.Name
class FirOnlyClassifiersScope(val delegate: FirScope) : FirScope() {
class FirOnlyClassifiersScope(val delegate: FirScope) : FirScope() , FirContainingNamesAwareScope {
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
return delegate.processClassifiersByNameWithSubstitution(name, processor)
}
override fun getCallableNames(): Set<Name> = emptySet()
override fun getClassifierNames(): Set<Name> = delegate.getContainingClassifierNamesIfPresent()
}
@@ -1,3 +1,4 @@
// FIR_COMPARISON
enum class E {
AAA
BBB