mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:01:42 +00:00
Update definite assignment for the code-as-ui changes
Change-Id: Id425fd6eb76402118738da13275224ae2d1905aa Reviewed-on: https://dart-review.googlesource.com/c/91168 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
fe285e3e60
commit
2f3ebf70f6
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
||||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -546,6 +546,12 @@ class DefiniteAssignmentTracker {
|
|||
_statementToStackIndex[statement] = _stack.length;
|
||||
}
|
||||
|
||||
void beginForStatement2(ForStatement2 statement) {
|
||||
// Not strongly necessary, because we discard everything anyway.
|
||||
// Just for consistency, so that `break` is handled without `null`.
|
||||
_statementToStackIndex[statement] = _stack.length;
|
||||
}
|
||||
|
||||
void beginForStatementBody() {
|
||||
_stack.add(_current); // break set
|
||||
_stack.add(_ElementSet.empty); // continue set
|
||||
|
|
|
@ -1356,6 +1356,42 @@ class _AstVisitor extends RecursiveAstVisitor<void> {
|
|||
tracker.endForStatement();
|
||||
}
|
||||
|
||||
@override
|
||||
void visitForStatement2(ForStatement2 node) {
|
||||
var parts = node.forLoopParts;
|
||||
VariableDeclarationList variables;
|
||||
Expression initialization;
|
||||
Expression condition;
|
||||
Expression iterable;
|
||||
NodeList<Expression> updaters;
|
||||
if (parts is ForPartsWithDeclarations) {
|
||||
variables = parts.variables;
|
||||
condition = parts.condition;
|
||||
updaters = parts.updaters;
|
||||
} else if (parts is ForPartsWithExpression) {
|
||||
initialization = parts.initialization;
|
||||
condition = parts.condition;
|
||||
updaters = parts.updaters;
|
||||
} else if (parts is ForEachParts) {
|
||||
iterable = parts.iterable;
|
||||
}
|
||||
|
||||
tracker.beginForStatement2(node);
|
||||
|
||||
variables?.accept(this);
|
||||
initialization?.accept(this);
|
||||
condition?.accept(this);
|
||||
iterable?.accept(this);
|
||||
|
||||
tracker.beginForStatementBody();
|
||||
node.body?.accept(this);
|
||||
|
||||
tracker.beginForStatementUpdaters();
|
||||
updaters?.accept(this);
|
||||
|
||||
tracker.endForStatement();
|
||||
}
|
||||
|
||||
@override
|
||||
void visitFunctionDeclaration(FunctionDeclaration node) {
|
||||
super.visitFunctionDeclaration(node);
|
||||
|
|
Loading…
Reference in a new issue