FIR: get rid of symbolProvider.getClassDeclaredMemberScope usages in compiler
This commit is contained in:
@@ -66,8 +66,8 @@ class JavaSymbolProvider(
|
|||||||
|
|
||||||
// NB: looks like it's better not to use this function at all...
|
// NB: looks like it's better not to use this function at all...
|
||||||
override fun getClassDeclaredMemberScope(classId: ClassId): FirScope? {
|
override fun getClassDeclaredMemberScope(classId: ClassId): FirScope? {
|
||||||
val classSymbol = getClassLikeSymbolByFqName(classId) ?: return null
|
// Anyway we cannot build correct declared member scope here
|
||||||
return declaredMemberScope(classSymbol.fir)
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getClassUseSiteMemberScope(
|
override fun getClassUseSiteMemberScope(
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ abstract class FirSymbolProvider : FirSessionComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun FirSymbolProvider.getClassDeclaredCallableSymbols(classId: ClassId, name: Name): List<FirCallableSymbol<*>> {
|
fun FirSymbolProvider.getClassDeclaredCallableSymbols(classId: ClassId, name: Name): List<FirCallableSymbol<*>> {
|
||||||
val declaredMemberScope = getClassDeclaredMemberScope(classId) ?: return emptyList()
|
val classSymbol = getClassLikeSymbolByFqName(classId) as? FirRegularClassSymbol ?: return emptyList()
|
||||||
|
val declaredMemberScope = declaredMemberScope(classSymbol.fir)
|
||||||
val result = mutableListOf<FirCallableSymbol<*>>()
|
val result = mutableListOf<FirCallableSymbol<*>>()
|
||||||
val processor: (FirCallableSymbol<*>) -> ProcessorAction = {
|
val processor: (FirCallableSymbol<*>) -> ProcessorAction = {
|
||||||
result.add(it)
|
result.add(it)
|
||||||
|
|||||||
+3
-2
@@ -18,10 +18,11 @@ import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype
|
|||||||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
import org.jetbrains.kotlin.fir.scopes.ProcessorAction
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperator
|
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperator
|
||||||
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperatorCall
|
import org.jetbrains.kotlin.fir.scopes.impl.FirIntegerOperatorCall
|
||||||
|
import org.jetbrains.kotlin.fir.scopes.impl.declaredMemberScope
|
||||||
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
import org.jetbrains.kotlin.fir.symbols.StandardClassIds
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
|
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
|
||||||
|
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult
|
import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
import org.jetbrains.kotlin.fir.visitors.FirTransformer
|
||||||
@@ -55,7 +56,7 @@ class IntegerLiteralTypeApproximationTransformer(
|
|||||||
functionCall.transformChildren(this, data)
|
functionCall.transformChildren(this, data)
|
||||||
val argumentType = functionCall.arguments.firstOrNull()?.resultType?.coneTypeUnsafe<ConeClassLikeType>()
|
val argumentType = functionCall.arguments.firstOrNull()?.resultType?.coneTypeUnsafe<ConeClassLikeType>()
|
||||||
val receiverClassId = functionCall.dispatchReceiver.typeRef.coneTypeUnsafe<ConeClassLikeType>().lookupTag.classId
|
val receiverClassId = functionCall.dispatchReceiver.typeRef.coneTypeUnsafe<ConeClassLikeType>().lookupTag.classId
|
||||||
val scope = symbolProvider.getClassDeclaredMemberScope(receiverClassId)!!
|
val scope = declaredMemberScope((symbolProvider.getClassLikeSymbolByFqName(receiverClassId) as FirRegularClassSymbol).fir)
|
||||||
var resultSymbol: FirFunctionSymbol<*>? = null
|
var resultSymbol: FirFunctionSymbol<*>? = null
|
||||||
scope.processFunctionsByName(operator.name) { symbol ->
|
scope.processFunctionsByName(operator.name) { symbol ->
|
||||||
if (operator.kind.unary) {
|
if (operator.kind.unary) {
|
||||||
|
|||||||
Reference in New Issue
Block a user