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

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1503063002: Handle const loop variable. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years 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
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | pkg/compiler/lib/src/resolution/variables.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index c41d5a1517f135e38515b03ed4cf5b3bc0ec6af4..460b34ef6da702008b527bc72c89685b85f82ab9 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -126,7 +126,7 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
/// When visiting the type declaration of the variable in a [ForIn] loop,
/// the initializer of the variable is implicit and we should not emit an
/// error when verifying that all final variables are initialized.
- bool allowFinalWithoutInitializer = false;
+ bool inLoopVariable = false;
/// The nodes for which variable access and mutation must be registered in
/// order to determine when the static type of variables types is promoted.
@@ -4387,10 +4387,10 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> {
Scope blockScope) {
LibraryElement library = enclosingElement.library;
- bool oldAllowFinalWithoutInitializer = allowFinalWithoutInitializer;
- allowFinalWithoutInitializer = true;
+ bool oldAllowFinalWithoutInitializer = inLoopVariable;
+ inLoopVariable = true;
visitIn(declaration, blockScope);
- allowFinalWithoutInitializer = oldAllowFinalWithoutInitializer;
+ inLoopVariable = oldAllowFinalWithoutInitializer;
Send send = declaration.asSend();
VariableDefinitions variableDefinitions =
« no previous file with comments | « pkg/compiler/lib/src/parser/parser.dart ('k') | pkg/compiler/lib/src/resolution/variables.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698