[FIR] extract functionality to a public function to use from Analysis API
^KT-62090
This commit is contained in:
committed by
Space Team
parent
a561a8e531
commit
e2d248b76d
+8
-4
@@ -165,10 +165,7 @@ fun ConeKotlinType.scopeForSupertype(
|
||||
|
||||
val symbol = lookupTag.toSymbol(useSiteSession) as? FirRegularClassSymbol ?: return null
|
||||
|
||||
val substitutor = when {
|
||||
this.type.attributes.contains(CompilerConeAttributes.RawType) -> ConeRawScopeSubstitutor(useSiteSession)
|
||||
else -> substitutor(symbol, this, useSiteSession)
|
||||
}
|
||||
val substitutor = substitutorForSuperType(useSiteSession, symbol)
|
||||
|
||||
return symbol.fir.scopeForClassImpl(
|
||||
substitutor,
|
||||
@@ -182,6 +179,13 @@ fun ConeKotlinType.scopeForSupertype(
|
||||
)
|
||||
}
|
||||
|
||||
fun ConeClassLikeType.substitutorForSuperType(useSiteSession: FirSession, classTypeSymbol: FirRegularClassSymbol): ConeSubstitutor {
|
||||
return when {
|
||||
this.type.attributes.contains(CompilerConeAttributes.RawType) -> ConeRawScopeSubstitutor(useSiteSession)
|
||||
else -> substitutor(classTypeSymbol, this, useSiteSession)
|
||||
}
|
||||
}
|
||||
|
||||
private fun substitutor(symbol: FirRegularClassSymbol, type: ConeClassLikeType, useSiteSession: FirSession): ConeSubstitutor {
|
||||
if (type.typeArguments.isEmpty()) return ConeSubstitutor.Empty
|
||||
val originalSubstitution = createSubstitutionForScope(symbol.fir.typeParameters, type, useSiteSession)
|
||||
|
||||
Reference in New Issue
Block a user