[FIR] Remove FirJsSyntheticNamesProvider and FirNativeSyntheticNamesProvider.kt

This commit is contained in:
Ivan Kochurkin
2022-07-01 21:45:25 +03:00
parent 502349c594
commit c47148b8fb
8 changed files with 20 additions and 44 deletions
@@ -15,4 +15,4 @@ abstract class FirSyntheticNamesProvider : FirSessionComponent {
abstract fun possiblePropertyNamesByAccessorName(name: Name): List<Name>
}
val FirSession.syntheticNamesProvider: FirSyntheticNamesProvider by FirSession.sessionComponentAccessor()
val FirSession.syntheticNamesProvider: FirSyntheticNamesProvider? by FirSession.nullableSessionComponentAccessor()
@@ -44,11 +44,23 @@ class FirSyntheticFunctionSymbol(
callableId: CallableId
) : FirNamedFunctionSymbol(callableId), SyntheticSymbol
class FirSyntheticPropertiesScope(
class FirSyntheticPropertiesScope private constructor(
val session: FirSession,
private val baseScope: FirTypeScope
private val baseScope: FirTypeScope,
private val syntheticNamesProvider: FirSyntheticNamesProvider
) : FirContainingNamesAwareScope() {
private val syntheticNamesProvider = session.syntheticNamesProvider
companion object {
fun createIfSyntheticNamesProviderIsDefined(
session: FirSession,
baseScope: FirTypeScope
): FirSyntheticPropertiesScope? {
val syntheticNamesProvider = session.syntheticNamesProvider
return if (syntheticNamesProvider != null)
FirSyntheticPropertiesScope(session, baseScope, syntheticNamesProvider)
else
null
}
}
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
val getterNames = syntheticNamesProvider.possibleGetterNamesByPropertyName(name)
@@ -105,8 +105,8 @@ class MemberScopeTowerLevel(
}
if (givenExtensionReceiverOptions.isEmpty()) {
val withSynthetic = FirSyntheticPropertiesScope(session, scope)
withSynthetic.processScopeMembers { symbol ->
val withSynthetic = FirSyntheticPropertiesScope.createIfSyntheticNamesProviderIsDefined(session, scope)
withSynthetic?.processScopeMembers { symbol ->
empty = false
output.consumeCandidate(symbol, dispatchReceiverValue, givenExtensionReceiverOptions = emptyList(), scope)
}