Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2908973002: Add type inference logic for "for-in" loops. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 1335994cb672fc3c2a83237fca81ddbed21bcc69..e1f143187499a895223d8f9e4eadc66700c0e83d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -2242,7 +2242,9 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
continueTarget.resolveContinues(body);
}
VariableDeclaration variable;
+ bool declaresVariable = false;
if (lvalue is VariableDeclaration) {
+ declaresVariable = true;
variable = lvalue;
} else if (lvalue is FastaAccessor) {
/// We are in this case, where `lvalue` isn't a [VariableDeclaration]:
@@ -2264,7 +2266,8 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
variable = new VariableDeclaration.forValue(buildCompileTimeError(
"Expected lvalue, but got ${lvalue}", forToken.next.next.charOffset));
}
- Statement result = new ForInStatement(variable, expression, body,
+ Statement result = new KernelForInStatement(
+ variable, expression, body, declaresVariable,
isAsync: awaitToken != null)
..fileOffset = body.fileOffset;
if (breakTarget.hasUsers) {

Powered by Google App Engine
This is Rietveld 408576698