[LL API] Migrate type reference check to FirExpression.type
'FirExpression.typeRef' is deprecated. Its new, temporary replacement is not passed to visitors, so the reference-handling code became dead.
This commit is contained in:
+9
-8
@@ -15,11 +15,11 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.parentsCodeFragmentA
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.toClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClassSymbol
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isInline
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isLocal
|
||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||
import org.jetbrains.kotlin.fir.expressions.FirResolvable
|
||||
import org.jetbrains.kotlin.fir.expressions.FirVariableAssignment
|
||||
import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol
|
||||
@@ -34,12 +34,12 @@ import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.FirTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.toSymbol
|
||||
import org.jetbrains.kotlin.fir.visitors.FirDefaultVisitorVoid
|
||||
import org.jetbrains.kotlin.name.StandardClassIds
|
||||
import org.jetbrains.kotlin.psi
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import java.util.*
|
||||
import kotlin.collections.LinkedHashMap
|
||||
|
||||
class CodeFragmentCapturedSymbol(
|
||||
val value: CodeFragmentCapturedValue,
|
||||
@@ -110,6 +110,13 @@ private class CodeFragmentCapturedValueVisitor(
|
||||
}
|
||||
|
||||
private fun processElement(element: FirElement) {
|
||||
if (element is FirExpression) {
|
||||
val symbol = element.coneTypeOrNull?.toSymbol(session)
|
||||
if (symbol != null) {
|
||||
registerFile(symbol)
|
||||
}
|
||||
}
|
||||
|
||||
when (element) {
|
||||
is FirSuperReference -> {
|
||||
val symbol = (element.superTypeRef as? FirResolvedTypeRef)?.toRegularClassSymbol(session)
|
||||
@@ -164,12 +171,6 @@ private class CodeFragmentCapturedValueVisitor(
|
||||
processCall(element, symbol)
|
||||
}
|
||||
}
|
||||
is FirTypeRef -> {
|
||||
val symbol = element.toClassLikeSymbol(session)
|
||||
if (symbol != null && symbol !in selfSymbols) {
|
||||
registerFile(symbol)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user