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

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: 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
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.
ngeoffray 2012/01/11 10:09:22 TODO(lrn): Must change cancel to error. Is error
Lasse Reichstein 2012/01/11 10:26:00 No, I was guessing that cancel was the right thing
+ print(declaration);
ngeoffray 2012/01/11 10:09:22 Remove print.
Lasse Reichstein 2012/01/11 10:26:00 Done.
+ cancel(node.declaredIdentifier, "Invalid variable declaration");
+ }
}
visitLabelledStatement(LabelledStatement node) {

Powered by Google App Engine
This is Rietveld 408576698