FIR IDE: remove duplicating withFirResolvedToBodyResolve
This commit is contained in:
+1
-1
@@ -61,7 +61,7 @@ internal class KtFirCompletionCandidateChecker(
|
|||||||
|
|
||||||
private inline fun <reified T : KtFirSymbol<F>, F : FirDeclaration, R> KtCallableSymbol.withResolvedFirOfType(
|
private inline fun <reified T : KtFirSymbol<F>, F : FirDeclaration, R> KtCallableSymbol.withResolvedFirOfType(
|
||||||
noinline action: (F) -> R,
|
noinline action: (F) -> R,
|
||||||
): R? = this.safeAs<T>()?.firRef?.withFirResolvedToBodyResolve(action)
|
): R? = this.safeAs<T>()?.firRef?.withFir(phase = FirResolvePhase.BODY_RESOLVE, action)
|
||||||
|
|
||||||
private fun checkExtension(
|
private fun checkExtension(
|
||||||
candidateSymbol: FirCallableDeclaration<*>,
|
candidateSymbol: FirCallableDeclaration<*>,
|
||||||
|
|||||||
+10
-11
@@ -25,17 +25,16 @@ internal class FirRefWithValidityCheck<D : FirDeclaration>(fir: D, resolveState:
|
|||||||
val resolveState = resolveStateWeakRef.get()
|
val resolveState = resolveStateWeakRef.get()
|
||||||
?: throw EntityWasGarbageCollectedException("FirModuleResolveState")
|
?: throw EntityWasGarbageCollectedException("FirModuleResolveState")
|
||||||
fir.resolvedFirToPhase(phase, resolveState)
|
fir.resolvedFirToPhase(phase, resolveState)
|
||||||
return resolveState.withFirDeclaration(fir) { action(it) }
|
return when (phase) {
|
||||||
}
|
FirResolvePhase.BODY_RESOLVE -> {
|
||||||
|
/*
|
||||||
inline fun <R> withFirResolvedToBodyResolve(action: (fir: D) -> R): R {
|
The BODY_RESOLVE phase is the maximum possible phase we can resolve our declaration to
|
||||||
token.assertIsValid()
|
So there is not need to run whole `action` under read lock
|
||||||
val fir = firWeakRef.get()
|
*/
|
||||||
?: throw EntityWasGarbageCollectedException("FirElement")
|
action(resolveState.withFirDeclaration(fir) { it })
|
||||||
val resolveState = resolveStateWeakRef.get()
|
}
|
||||||
?: throw EntityWasGarbageCollectedException("FirModuleResolveState")
|
else -> resolveState.withFirDeclaration(fir) { action(it) }
|
||||||
fir.resolvedFirToPhase(FirResolvePhase.BODY_RESOLVE, resolveState)
|
}
|
||||||
return action(resolveState.withFirDeclaration(fir) { it })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val resolveState
|
val resolveState
|
||||||
|
|||||||
Reference in New Issue
Block a user