org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-compiler-embeddable Show documentation
Show all versions of kotlin-compiler-embeddable Show documentation
the Kotlin compiler embeddable
/*
* Copyright 2010-2020 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.FirSession
import org.jetbrains.kotlin.fir.resolve.ScopeSession
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.name.Name
abstract class FirContainingNamesAwareScope : FirScope() {
abstract fun getCallableNames(): Set
abstract fun getClassifierNames(): Set
@DelicateScopeAPI
abstract override fun withReplacedSessionOrNull(newSession: FirSession, newScopeSession: ScopeSession): FirContainingNamesAwareScope?
}
fun FirContainingNamesAwareScope.processAllFunctions(processor: (FirNamedFunctionSymbol) -> Unit) {
for (name in getCallableNames()) {
processFunctionsByName(name, processor)
}
}
fun FirContainingNamesAwareScope.processAllProperties(processor: (FirVariableSymbol<*>) -> Unit) {
for (name in getCallableNames()) {
processPropertiesByName(name, processor)
}
}
fun FirContainingNamesAwareScope.processAllCallables(processor: (FirCallableSymbol<*>) -> Unit) {
for (name in getCallableNames()) {
processFunctionsByName(name, processor)
processPropertiesByName(name, processor)
}
}
fun FirContainingNamesAwareScope.processAllClassifiers(processor: (FirClassifierSymbol<*>) -> Unit) {
for (name in getClassifierNames()) {
processClassifiersByName(name, processor)
}
}
fun FirContainingNamesAwareScope.collectAllProperties(): Collection> {
return mutableListOf>().apply {
processAllProperties(this::add)
}
}
fun FirContainingNamesAwareScope.collectAllFunctions(): Collection {
return mutableListOf().apply {
processAllFunctions(this::add)
}
}