FIR: move getCallableNames/getClassifierNames from scope to FirContainingNamesAwareScope

This commit is contained in:
Ilya Kirillov
2020-08-07 13:00:43 +03:00
parent 36a161080f
commit f62204fff1
27 changed files with 247 additions and 146 deletions
@@ -7,21 +7,32 @@ package org.jetbrains.kotlin.idea.frontend.api.scopes
import org.jetbrains.kotlin.idea.frontend.api.ValidityTokenOwner
import org.jetbrains.kotlin.idea.frontend.api.symbols.*
import org.jetbrains.kotlin.idea.frontend.api.withValidityAssertion
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
interface KtScope : ValidityTokenOwner {
// TODO check that names are accessible
// maybe return some kind of lazy set
fun getAllNames(): Set<Name>
fun getAllNames(): Set<Name> = withValidityAssertion { getCallableNames() + getClassLikeSymbolNames() }
fun getCallableNames(): Set<Name>
fun getClassLikeSymbolNames(): Set<Name>
fun getAllSymbols(): Sequence<KtSymbol>
fun getAllSymbols(): Sequence<KtSymbol> = withValidityAssertion {
sequence {
yieldAll(getCallableSymbols())
yieldAll(getClassClassLikeSymbols())
}
}
fun getCallableSymbols(): Sequence<KtCallableSymbol>
fun getClassClassLikeSymbols(): Sequence<KtClassLikeSymbol>
fun containsName(name: Name): Boolean
fun containsName(name: Name): Boolean = withValidityAssertion {
name in getCallableNames() || name in getClassLikeSymbolNames()
}
}
interface KtCompositeScope : KtScope {
@@ -37,7 +48,7 @@ interface KtDeclaredMemberScope : KtScope {
}
interface KtPackageScope : KtScope, KtSubstitutedScope<KtPackageScope> {
val owner: KtPackageSymbol
val fqName: FqName
}
interface KtUnsubstitutedScope<S : KtScope> : KtScope {