@@ -351,6 +351,9 @@ abstract class FlowAnalysis<Node, Statement extends Node, Expression, Variable,
351351 /// Call this method when visiting a boolean literal expression.
352352 void booleanLiteral (Expression expression, bool value);
353353
354+ /// Call this method just before visiting a conditional expression ("?:").
355+ void conditional_conditionBegin ();
356+
354357 /// Call this method upon reaching the ":" part of a conditional expression
355358 /// ("?:"). [thenExpression] should be the expression preceding the ":".
356359 void conditional_elseBegin (Expression thenExpression);
@@ -866,6 +869,12 @@ class FlowAnalysisDebug<Node, Statement extends Node, Expression, Variable,
866869 () => _wrapped.booleanLiteral (expression, value));
867870 }
868871
872+ @override
873+ void conditional_conditionBegin () {
874+ _wrap ('conditional_conditionBegin()' ,
875+ () => _wrapped.conditional_conditionBegin ());
876+ }
877+
869878 @override
870879 void conditional_elseBegin (Expression thenExpression) {
871880 _wrap ('conditional_elseBegin($thenExpression ' ,
@@ -2731,6 +2740,11 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
27312740 : new ExpressionInfo (_current, unreachable, _current));
27322741 }
27332742
2743+ @override
2744+ void conditional_conditionBegin () {
2745+ _current = _current.split ();
2746+ }
2747+
27342748 @override
27352749 void conditional_elseBegin (Expression thenExpression) {
27362750 _ConditionalContext <Variable , Type > context =
@@ -2749,9 +2763,9 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
27492763 _storeExpressionInfo (
27502764 conditionalExpression,
27512765 new ExpressionInfo (
2752- _join (thenInfo.after, elseInfo.after),
2753- _join (thenInfo.ifTrue, elseInfo.ifTrue),
2754- _join (thenInfo.ifFalse, elseInfo.ifFalse)));
2766+ _merge (thenInfo.after, elseInfo.after),
2767+ _merge (thenInfo.ifTrue, elseInfo.ifTrue),
2768+ _merge (thenInfo.ifFalse, elseInfo.ifFalse)));
27552769 }
27562770
27572771 @override
@@ -2771,9 +2785,9 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
27712785 AssignedVariablesNodeInfo <Variable > info =
27722786 _assignedVariables._getInfoForNode (doStatement);
27732787 _BranchTargetContext <Variable , Type > context =
2774- new _BranchTargetContext <Variable , Type >(_current.reachable.parent );
2788+ new _BranchTargetContext <Variable , Type >(_current.reachable);
27752789 _stack.add (context);
2776- _current = _current.conservativeJoin (info._written, info._captured);
2790+ _current = _current.conservativeJoin (info._written, info._captured). split () ;
27772791 _statementToContext[doStatement] = context;
27782792 }
27792793
@@ -2788,7 +2802,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
27882802 void doStatement_end (Expression condition) {
27892803 _BranchTargetContext <Variable , Type > context =
27902804 _stack.removeLast () as _BranchTargetContext <Variable , Type >;
2791- _current = _join (_expressionEnd (condition).ifFalse, context._breakModel);
2805+ _current = _merge (_expressionEnd (condition).ifFalse, context._breakModel);
27922806 }
27932807
27942808 @override
@@ -2868,7 +2882,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
28682882 void for_conditionBegin (Node node) {
28692883 AssignedVariablesNodeInfo <Variable > info =
28702884 _assignedVariables._getInfoForNode (node);
2871- _current = _current.conservativeJoin (info._written, info._captured);
2885+ _current = _current.conservativeJoin (info._written, info._captured). split () ;
28722886 }
28732887
28742888 @override
@@ -2879,7 +2893,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
28792893 FlowModel <Variable , Type > breakState = context._breakModel;
28802894 FlowModel <Variable , Type > falseCondition = context._conditionInfo.ifFalse;
28812895
2882- _current = _join (falseCondition, breakState)
2896+ _current = _merge (falseCondition, breakState)
28832897 .inheritTested (typeOperations, _current);
28842898 }
28852899
@@ -2894,7 +2908,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
28942908 void forEach_bodyBegin (Node node, Variable loopVariable, Type writtenType) {
28952909 AssignedVariablesNodeInfo <Variable > info =
28962910 _assignedVariables._getInfoForNode (node);
2897- _current = _current.conservativeJoin (info._written, info._captured);
2911+ _current = _current.conservativeJoin (info._written, info._captured). split () ;
28982912 _SimpleStatementContext <Variable , Type > context =
28992913 new _SimpleStatementContext <Variable , Type >(
29002914 _current.reachable.parent, _current);
@@ -2908,7 +2922,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
29082922 void forEach_end () {
29092923 _SimpleStatementContext <Variable , Type > context =
29102924 _stack.removeLast () as _SimpleStatementContext <Variable , Type >;
2911- _current = _join (_current, context._previous);
2925+ _current = _merge (_current, context._previous);
29122926 }
29132927
29142928 @override
0 commit comments