FIR DFA: split Flow into PersistentFlow and MutableFlow

The distinction is similar to persistent data structures and their
builders. Only the MutableFlow can be passed to LogicSystem for
modification; when it's ready, it can be converted into PersistentFlow
and attached to a CFG node.

The result is that the API is cleaner, the implementation is a bit more
neat, and hopefully the use of PersistentHashMap.Builder improves
performance a little. Also the node-to-flow map can now be removed in
favor of just storing PersistentFlow inside a node, seeing as it's
explicitly immutable and all that.
This commit is contained in:
pyos
2022-11-19 11:21:21 +01:00
committed by teamcity
parent e1f0566738
commit 8d2ac141c3
15 changed files with 438 additions and 448 deletions
@@ -47,9 +47,9 @@ internal open class StubBodyResolveTransformerComponents(
transformer,
context,
) {
override val dataFlowAnalyzer: FirDataFlowAnalyzer<*>
get() = object : FirDataFlowAnalyzer<PersistentFlow>(this@StubBodyResolveTransformerComponents, context.dataFlowAnalyzerContext) {
override val logicSystem: LogicSystem<PersistentFlow>
override val dataFlowAnalyzer: FirDataFlowAnalyzer
get() = object : FirDataFlowAnalyzer(this@StubBodyResolveTransformerComponents, context.dataFlowAnalyzerContext) {
override val logicSystem: LogicSystem
get() = error("Should not be called")
override val receiverStack: Iterable<ImplicitReceiverValue<*>>