[FIR] Rearrange arguments in VariableStorageImpl functions to make them consistent
This commit is contained in:
+4
-4
@@ -114,7 +114,7 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
|
||||
override fun updateAllReceivers(flow: PersistentFlow) {
|
||||
receiverStack.forEach {
|
||||
variableStorage.getRealVariable(it.boundSymbol, it.receiverExpression, flow)?.let { variable ->
|
||||
variableStorage.getRealVariable(flow, it.boundSymbol, it.receiverExpression)?.let { variable ->
|
||||
processUpdatedReceiverVariable(flow, variable)
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
} ?: return false
|
||||
} ?: return false
|
||||
return context.firLocalVariableAssignmentAnalyzer?.isAccessToUnstableLocalVariable(qualifiedAccessExpression) == true
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
expression: FirExpression
|
||||
): Pair<PropertyStability, MutableList<ConeKotlinType>>? {
|
||||
val flow = graphBuilder.lastNode.flow
|
||||
var variable = variableStorage.getRealVariableWithoutUnwrappingAlias(symbol, expression, flow) ?: return null
|
||||
var variable = variableStorage.getRealVariableWithoutUnwrappingAlias(flow, symbol, expression) ?: return null
|
||||
val stability = variable.stability
|
||||
val result = mutableListOf<ConeKotlinType>()
|
||||
flow.directAliasMap[variable]?.let {
|
||||
@@ -836,7 +836,7 @@ abstract class FirDataFlowAnalyzer<FLOW : Flow>(
|
||||
val (loopConditionExitNode, loopBlockEnterNode) = graphBuilder.exitWhileLoopCondition(loop)
|
||||
loopConditionExitNode.mergeIncomingFlow()
|
||||
val conditionExitFlow = loopConditionExitNode.flow
|
||||
loopBlockEnterNode.flow = variableStorage.getVariable(loop.condition, conditionExitFlow)?.let { conditionVariable ->
|
||||
loopBlockEnterNode.flow = variableStorage.getVariable(conditionExitFlow, loop.condition)?.let { conditionVariable ->
|
||||
logicSystem.approveStatementsInsideFlow(
|
||||
conditionExitFlow,
|
||||
conditionVariable eq true,
|
||||
|
||||
@@ -9,8 +9,8 @@ import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||
|
||||
abstract class VariableStorage {
|
||||
abstract fun getRealVariableWithoutUnwrappingAlias(symbol: FirBasedSymbol<*>?, fir: FirElement, flow: Flow): RealVariable?
|
||||
abstract fun getRealVariable(symbol: FirBasedSymbol<*>?, fir: FirElement, flow: Flow): RealVariable?
|
||||
abstract fun getRealVariableWithoutUnwrappingAlias(flow: Flow, symbol: FirBasedSymbol<*>?, fir: FirElement): RealVariable?
|
||||
abstract fun getRealVariable(flow: Flow, symbol: FirBasedSymbol<*>?, fir: FirElement): RealVariable?
|
||||
abstract fun getSyntheticVariable(fir: FirElement): SyntheticVariable?
|
||||
abstract fun getVariable(fir: FirElement, flow: Flow): DataFlowVariable?
|
||||
abstract fun getVariable(flow: Flow, fir: FirElement): DataFlowVariable?
|
||||
}
|
||||
|
||||
+5
-5
@@ -127,27 +127,27 @@ class VariableStorageImpl(private val session: FirSession) : VariableStorage() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRealVariableWithoutUnwrappingAlias(symbol: FirBasedSymbol<*>?, fir: FirElement, flow: Flow): RealVariable? {
|
||||
override fun getRealVariableWithoutUnwrappingAlias(flow: Flow, symbol: FirBasedSymbol<*>?, fir: FirElement): RealVariable? {
|
||||
val realFir = fir.unwrapElement()
|
||||
return symbol.takeIf { it.getStability(realFir) != null }?.let {
|
||||
_realVariables[getIdentifierBySymbol(flow, it, realFir.unwrapElement())]
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRealVariable(symbol: FirBasedSymbol<*>?, fir: FirElement, flow: Flow): RealVariable? {
|
||||
return getRealVariableWithoutUnwrappingAlias(symbol, fir, flow)?.let { flow.unwrapVariable(it) }
|
||||
override fun getRealVariable(flow: Flow, symbol: FirBasedSymbol<*>?, fir: FirElement): RealVariable? {
|
||||
return getRealVariableWithoutUnwrappingAlias(flow, symbol, fir)?.let { flow.unwrapVariable(it) }
|
||||
}
|
||||
|
||||
override fun getSyntheticVariable(fir: FirElement): SyntheticVariable? {
|
||||
return syntheticVariables[fir.unwrapElement()]
|
||||
}
|
||||
|
||||
override fun getVariable(fir: FirElement, flow: Flow): DataFlowVariable? {
|
||||
override fun getVariable(flow: Flow, fir: FirElement): DataFlowVariable? {
|
||||
val realFir = fir.unwrapElement()
|
||||
val symbol = realFir.symbol
|
||||
val stability = symbol.getStability(fir)
|
||||
return if (stability != null) {
|
||||
getRealVariable(symbol, realFir, flow)
|
||||
getRealVariable(flow, symbol, realFir)
|
||||
} else {
|
||||
getSyntheticVariable(fir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user