mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 17:56:11 +00:00
Ensure that for
statements promote properly in unreachable code.
Bug: https://github.com/dart-lang/sdk/issues/40009 Change-Id: I87ea8c8cd943c0c44d795aec084e012b3e2b4496 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166500 Reviewed-by: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
c39b1642b6
commit
7aa9444059
|
@ -2882,7 +2882,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
|
|||
void for_conditionBegin(Node node) {
|
||||
AssignedVariablesNodeInfo<Variable> info =
|
||||
_assignedVariables._getInfoForNode(node);
|
||||
_current = _current.conservativeJoin(info._written, info._captured);
|
||||
_current = _current.conservativeJoin(info._written, info._captured).split();
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -2893,7 +2893,7 @@ class _FlowAnalysisImpl<Node, Statement extends Node, Expression, Variable,
|
|||
FlowModel<Variable, Type> breakState = context._breakModel;
|
||||
FlowModel<Variable, Type> falseCondition = context._conditionInfo.ifFalse;
|
||||
|
||||
_current = _join(falseCondition, breakState)
|
||||
_current = _merge(falseCondition, breakState)
|
||||
.inheritTested(typeOperations, _current);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,22 @@ doCondition(Object o) {
|
|||
/*int*/ o;
|
||||
}
|
||||
|
||||
forBreak(Object o) {
|
||||
return;
|
||||
for (;;) {
|
||||
if (o is int) break;
|
||||
}
|
||||
/*int*/ o;
|
||||
}
|
||||
|
||||
forContinue(Object o) {
|
||||
return;
|
||||
for (;; /*int*/ o) {
|
||||
if (o is int) continue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ifIsNot(Object o) {
|
||||
return;
|
||||
if (o is! int) return;
|
||||
|
|
Loading…
Reference in a new issue