FIR DFA: take all statements from ?. if result is non-null.
I.e. a?.f(b as T) != null => b is T. This also allows to remove the copyAllInformationFrom hack by moving the edge directly in the control flow graph.
This commit is contained in:
@@ -21,7 +21,6 @@ abstract class LogicSystem<FLOW : Flow>(protected val context: ConeInferenceCont
|
||||
abstract fun addImplication(flow: FLOW, implication: Implication)
|
||||
abstract fun addLocalVariableAlias(flow: FLOW, alias: RealVariable, underlyingVariable: RealVariable)
|
||||
abstract fun recordNewAssignment(flow: FLOW, variable: RealVariable, index: Int)
|
||||
abstract fun copyAllInformation(from: FLOW, to: FLOW)
|
||||
abstract fun isSameValueIn(a: FLOW, b: FLOW, variable: RealVariable): Boolean
|
||||
|
||||
abstract fun translateVariableFromConditionInStatements(
|
||||
|
||||
-8
@@ -79,14 +79,6 @@ abstract class PersistentLogicSystem(context: ConeInferenceContext) : LogicSyste
|
||||
override fun forkFlow(flow: PersistentFlow): PersistentFlow =
|
||||
PersistentFlow(flow)
|
||||
|
||||
override fun copyAllInformation(from: PersistentFlow, to: PersistentFlow) {
|
||||
to.approvedTypeStatements = from.approvedTypeStatements
|
||||
to.logicStatements = from.logicStatements
|
||||
to.directAliasMap = from.directAliasMap
|
||||
to.backwardsAliasMap = from.backwardsAliasMap
|
||||
to.assignmentIndex = from.assignmentIndex
|
||||
}
|
||||
|
||||
override fun joinFlow(flows: Collection<PersistentFlow>): PersistentFlow =
|
||||
foldFlow(flows, allExecute = false)
|
||||
|
||||
|
||||
@@ -781,8 +781,6 @@ class EnterSafeCallNode(owner: ControlFlowGraph, override val fir: FirSafeCallEx
|
||||
}
|
||||
}
|
||||
class ExitSafeCallNode(owner: ControlFlowGraph, override val fir: FirSafeCallExpression, level: Int, id: Int) : CFGNode<FirSafeCallExpression>(owner, level, id) {
|
||||
val lastNodeInNotNullCase: CFGNode<*>? get() = previousNodes.getOrNull(1)
|
||||
|
||||
override fun <R, D> accept(visitor: ControlFlowGraphVisitor<R, D>, data: D): R {
|
||||
return visitor.visitExitSafeCallNode(this, data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user