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

Unified Diff: frog/leg/resolver.dart

Issue 9139014: Allow for-in to use a previously declared identifier as variable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add more tests Created 8 years, 11 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
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | frog/leg/ssa/builder.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/resolver.dart
diff --git a/frog/leg/resolver.dart b/frog/leg/resolver.dart
index 6a8342687b8c928376d1e8912624278d79582889..38e3e0cfe6e62a6365635d93d25f40392d291e42 100644
--- a/frog/leg/resolver.dart
+++ b/frog/leg/resolver.dart
@@ -521,12 +521,12 @@ class FullResolverVisitor extends ResolverVisitor {
visitIn(declaration, scope);
visitIn(node.body, scope);
// TODO(lrn): Also allow a single identifier.
- if (declaration is !VariableDefinitions ||
- !declaration.definitions.nodes.tail.isEmpty()) {
- // The variable declaration is either not a declaration, or it's
- // declaring more than one variable.
- error(node.declaredIdentifier, MessageKind.GENERIC,
- ["Invalid variable declaration in for-in"]);
+ if ((declaration is !Send || declaration.selector is !Identifier) &&
+ (declaration is !VariableDefinitions ||
+ !declaration.definitions.nodes.tail.isEmpty())) {
+ // The variable declaration is either not an identifier, not a
+ // declaration, or it's declaring more than one variable.
+ error(node.declaredIdentifier, MessageKind.INVALID_FOR_IN, []);
}
}
« no previous file with comments | « no previous file | frog/leg/ssa/builder.dart » ('j') | frog/leg/ssa/builder.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698