mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:40:04 +00:00
Ensure that do
statements promote properly in unreachable code.
Bug: https://github.com/dart-lang/sdk/issues/40009 Change-Id: I2c53e1171bb986784b1f0e18e35556f7d6afcb15 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166320 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
57932cfb4f
commit
c39b1642b6
|
@ -2785,9 +2785,9 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
|
|||
AssignedVariablesNodeInfo<Variable> info =
|
||||
_assignedVariables._getInfoForNode(doStatement);
|
||||
_BranchTargetContext<Variable, Type> context =
|
||||
new _BranchTargetContext<Variable, Type>(_current.reachable.parent);
|
||||
new _BranchTargetContext<Variable, Type>(_current.reachable);
|
||||
_stack.add(context);
|
||||
_current = _current.conservativeJoin(info._written, info._captured);
|
||||
_current = _current.conservativeJoin(info._written, info._captured).split();
|
||||
_statementToContext[doStatement] = context;
|
||||
}
|
||||
|
||||
|
@ -2802,7 +2802,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
|
|||
void doStatement_end(Expression condition) {
|
||||
_BranchTargetContext<Variable, Type> context =
|
||||
_stack.removeLast() as _BranchTargetContext<Variable, Type>;
|
||||
_current = _join(_expressionEnd(condition).ifFalse, context._breakModel);
|
||||
_current = _merge(_expressionEnd(condition).ifFalse, context._breakModel);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -30,6 +30,29 @@ conditionalJoinTrue(Object o, bool b) {
|
|||
/*int*/ o;
|
||||
}
|
||||
|
||||
doBreak(Object o) {
|
||||
return;
|
||||
do {
|
||||
if (o is int) break;
|
||||
} while (true);
|
||||
/*int*/ o;
|
||||
}
|
||||
|
||||
doContinue(Object o) {
|
||||
return;
|
||||
do {
|
||||
if (o is int) continue;
|
||||
return;
|
||||
} while (false);
|
||||
/*int*/ o;
|
||||
}
|
||||
|
||||
doCondition(Object o) {
|
||||
return;
|
||||
do {} while (o is! int);
|
||||
/*int*/ o;
|
||||
}
|
||||
|
||||
ifIsNot(Object o) {
|
||||
return;
|
||||
if (o is! int) return;
|
||||
|
|
Loading…
Reference in a new issue