Skip to content

Commit 59db156

Browse files
stereotype441Commit Queue
authored andcommitted
[flow analysis] Make split/conseravativeJoin order more uniform.
While doing specification work for flow analysis, I noticed that in circumstances where a flow model needs to have both the `split` and `conservativeJoin` operations applied to it, sometimes flow analysis applied `split` first, and sometimes it applied `conservativeJoin` first. The actual order doesn't matter, since `split` only affects the flow model's reachability, and `conservativeJoin` only affects the flow model's variable info. But for the purpose of making the specification clearer, it's nice to be consistent. This change adjusts the order so that `split` always happens before `conservativeJoin`. Change-Id: Ia5dfc9335ee85f122ae274f6bb850f83f12b88d2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437060 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent d2923b2 commit 59db156

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5525,8 +5525,11 @@ class _FlowAnalysisImpl<
55255525
_current.reachable,
55265526
);
55275527
_stack.add(context);
5528-
_current =
5529-
_current.conservativeJoin(this, info.written, info.captured).split();
5528+
_current = _current.split().conservativeJoin(
5529+
this,
5530+
info.written,
5531+
info.captured,
5532+
);
55305533
_statementToContext[doStatement] = context;
55315534
}
55325535

@@ -5667,8 +5670,11 @@ class _FlowAnalysisImpl<
56675670
@override
56685671
void for_conditionBegin(Node node) {
56695672
AssignedVariablesNodeInfo info = _assignedVariables.getInfoForNode(node);
5670-
_current =
5671-
_current.conservativeJoin(this, info.written, info.captured).split();
5673+
_current = _current.split().conservativeJoin(
5674+
this,
5675+
info.written,
5676+
info.captured,
5677+
);
56725678
}
56735679

56745680
@override
@@ -5694,8 +5700,11 @@ class _FlowAnalysisImpl<
56945700
@override
56955701
void forEach_bodyBegin(Node node) {
56965702
AssignedVariablesNodeInfo info = _assignedVariables.getInfoForNode(node);
5697-
_current =
5698-
_current.conservativeJoin(this, info.written, info.captured).split();
5703+
_current = _current.split().conservativeJoin(
5704+
this,
5705+
info.written,
5706+
info.captured,
5707+
);
56995708
_SimpleStatementContext<Type> context = new _SimpleStatementContext<Type>(
57005709
_current.reachable.parent!,
57015710
_current,

0 commit comments

Comments
 (0)