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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/leg/lib/core.dart ('k') | frog/leg/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class TreeElements { 5 class TreeElements {
6 Map<Node, Element> map; 6 Map<Node, Element> map;
7 TreeElements() : map = new LinkedHashMap<Node, Element>(); 7 TreeElements() : map = new LinkedHashMap<Node, Element>();
8 operator []=(Node node, Element element) => map[node] = element; 8 operator []=(Node node, Element element) => map[node] = element;
9 operator [](Node node) => map[node]; 9 operator [](Node node) => map[node];
10 } 10 }
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 visitBreakStatement(BreakStatement node) { 483 visitBreakStatement(BreakStatement node) {
484 cancel(node, 'unimplemented'); 484 cancel(node, 'unimplemented');
485 } 485 }
486 486
487 visitContinueStatement(ContinueStatement node) { 487 visitContinueStatement(ContinueStatement node) {
488 cancel(node, 'unimplemented'); 488 cancel(node, 'unimplemented');
489 } 489 }
490 490
491 visitForInStatement(ForInStatement node) { 491 visitForInStatement(ForInStatement node) {
492 cancel(node, 'unimplemented'); 492 visit(node.expression);
493 Scope scope = new BlockScope(context);
494 Node declaration = node.declaredIdentifier;
495 visitIn(declaration, scope);
496 visitIn(node.body, scope);
497 if (declaration is !VariableDefinitions ||
498 !declaration.definitions.nodes.tail.isEmpty()) {
499 // The variable declaration is either not a declaration, or it's
500 // declaring more than one variable.
501 // TODO(lrn): A non-terminating error report would be fine here.
502 print(declaration);
503 cancel(node.declaredIdentifier, "Invalid variable declaration");
504 }
493 } 505 }
494 506
495 visitLabelledStatement(LabelledStatement node) { 507 visitLabelledStatement(LabelledStatement node) {
496 cancel(node, 'unimplemented'); 508 cancel(node, 'unimplemented');
497 } 509 }
498 510
499 visitLiteralMap(LiteralMap node) { 511 visitLiteralMap(LiteralMap node) {
500 cancel(node, 'unimplemented'); 512 cancel(node, 'unimplemented');
501 } 513 }
502 514
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 class TopScope extends Scope { 726 class TopScope extends Scope {
715 Universe universe; 727 Universe universe;
716 728
717 TopScope(Universe this.universe) : super(null, null); 729 TopScope(Universe this.universe) : super(null, null);
718 Element lookup(SourceString name) => universe.find(name); 730 Element lookup(SourceString name) => universe.find(name);
719 731
720 Element add(Element element) { 732 Element add(Element element) {
721 throw "Cannot add an element in the top scope"; 733 throw "Cannot add an element in the top scope";
722 } 734 }
723 } 735 }
OLDNEW
« 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