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

Unified Diff: frog/leg/resolver.dart

Issue 9148021: Implement for-in. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made test work. 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 | « frog/leg/lib/core.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
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 0719b23532b118b0a745d247f5e136ca5e7ec904..144c080424de59d5ce78169aa28a0e9a8fb2c6e8 100644
--- a/frog/leg/resolver.dart
+++ b/frog/leg/resolver.dart
@@ -489,7 +489,19 @@ class FullResolverVisitor extends ResolverVisitor {
}
visitForInStatement(ForInStatement node) {
- cancel(node, 'unimplemented');
+ visit(node.expression);
+ Scope scope = new BlockScope(context);
+ Node declaration = node.declaredIdentifier;
+ visitIn(declaration, scope);
+ visitIn(node.body, scope);
+ 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.
+ // TODO(lrn): A non-terminating error report would be fine here.
+ print(declaration);
+ cancel(node.declaredIdentifier, "Invalid variable declaration");
+ }
}
visitLabelledStatement(LabelledStatement node) {
« no previous file with comments | « frog/leg/lib/core.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698