[FIR] Remove FirJsSyntheticNamesProvider and FirNativeSyntheticNamesProvider.kt
This commit is contained in:
+2
-2
@@ -185,9 +185,9 @@ internal class KtFirScopeProvider(
|
||||
FakeOverrideTypeCalculator.Forced
|
||||
) ?: return null
|
||||
return KtCompositeTypeScope(
|
||||
listOf(
|
||||
listOfNotNull(
|
||||
convertToKtTypeScope(firTypeScope),
|
||||
convertToKtTypeScope(FirSyntheticPropertiesScope(firSession, firTypeScope))
|
||||
FirSyntheticPropertiesScope.createIfSyntheticNamesProviderIsDefined(firSession, firTypeScope)?.let { convertToKtTypeScope(it) }
|
||||
),
|
||||
token
|
||||
)
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
+2
-2
@@ -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)
|
||||
}
|
||||
|
||||
-1
@@ -90,7 +90,6 @@ object FirJsSessionFactory : FirAbstractSessionFactory() {
|
||||
register(FirVisibilityChecker::class, FirVisibilityChecker.Default)
|
||||
register(ConeCallConflictResolverFactory::class, JsCallConflictResolverFactory)
|
||||
register(FirPlatformClassMapper::class, FirPlatformClassMapper.Default)
|
||||
register(FirSyntheticNamesProvider::class, FirJsSyntheticNamesProvider)
|
||||
register(FirOverridesBackwardCompatibilityHelper::class, FirOverridesBackwardCompatibilityHelper.Default())
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.test.frontend.fir
|
||||
|
||||
import org.jetbrains.kotlin.fir.NoMutableState
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider
|
||||
import org.jetbrains.kotlin.load.java.setMethodName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
@NoMutableState
|
||||
object FirJsSyntheticNamesProvider : FirSyntheticNamesProvider() {
|
||||
override fun possibleGetterNamesByPropertyName(name: Name): List<Name> = emptyList()
|
||||
override fun setterNameByGetterName(name: Name): Name = setMethodName(getMethodName = name)
|
||||
override fun possiblePropertyNamesByAccessorName(name: Name): List<Name> = emptyList()
|
||||
}
|
||||
-1
@@ -78,7 +78,6 @@ object FirNativeSessionFactory : FirAbstractSessionFactory() {
|
||||
register(FirVisibilityChecker::class, FirVisibilityChecker.Default)
|
||||
register(ConeCallConflictResolverFactory::class, NativeCallConflictResolverFactory)
|
||||
register(FirPlatformClassMapper::class, FirPlatformClassMapper.Default)
|
||||
register(FirSyntheticNamesProvider::class, FirNativeSyntheticNamesProvider)
|
||||
register(FirOverridesBackwardCompatibilityHelper::class, FirOverridesBackwardCompatibilityHelper.Default())
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.test.frontend.fir
|
||||
|
||||
import org.jetbrains.kotlin.fir.resolve.calls.FirSyntheticNamesProvider
|
||||
import org.jetbrains.kotlin.load.java.setMethodName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
object FirNativeSyntheticNamesProvider : FirSyntheticNamesProvider() {
|
||||
override fun possibleGetterNamesByPropertyName(name: Name): List<Name> = emptyList()
|
||||
override fun setterNameByGetterName(name: Name): Name = setMethodName(getMethodName = name)
|
||||
override fun possiblePropertyNamesByAccessorName(name: Name): List<Name> = emptyList()
|
||||
}
|
||||
Reference in New Issue
Block a user