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

Side by Side Diff: frog/leg/resolver.dart

Issue 9863037: Generate prettier loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adressed review comments. A few fixes. Created 8 years, 8 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 | « no previous file | frog/leg/scanner/listener.dart » ('j') | frog/leg/ssa/codegen.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 } 8 }
9 9
10 class TreeElementMapping implements TreeElements { 10 class TreeElementMapping implements TreeElements {
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 LabelElement label = statementScope.lookupLabel(labelName); 1071 LabelElement label = statementScope.lookupLabel(labelName);
1072 if (label === null) { 1072 if (label === null) {
1073 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]); 1073 error(node.target, MessageKind.UNBOUND_LABEL, [labelName]);
1074 return; 1074 return;
1075 } 1075 }
1076 target = label.target; 1076 target = label.target;
1077 if (!target.statement.isValidContinueTarget()) { 1077 if (!target.statement.isValidContinueTarget()) {
1078 error(node.target, MessageKind.INVALID_CONTINUE, [labelName]); 1078 error(node.target, MessageKind.INVALID_CONTINUE, [labelName]);
1079 } 1079 }
1080 label.setContinueTarget(); 1080 label.setContinueTarget();
1081 mapping[node.target] = label;
1081 } 1082 }
1082 mapping[node] = target; 1083 mapping[node] = target;
1083 } 1084 }
1084 1085
1085 visitForInStatement(ForInStatement node) { 1086 visitForIn(ForIn node) {
1086 visit(node.expression); 1087 visit(node.expression);
1087 Scope scope = new BlockScope(context); 1088 Scope scope = new BlockScope(context);
1088 Node declaration = node.declaredIdentifier; 1089 Node declaration = node.declaredIdentifier;
1089 visitIn(declaration, scope); 1090 visitIn(declaration, scope);
1090 visitLoopBodyIn(node, node.body, scope); 1091 visitLoopBodyIn(node, node.body, scope);
1091 1092
1092 // TODO(lrn): Also allow a single identifier. 1093 // TODO(lrn): Also allow a single identifier.
1093 if ((declaration is !Send || declaration.asSend().selector is !Identifier) 1094 if ((declaration is !Send || declaration.asSend().selector is !Identifier)
1094 && (declaration is !VariableDefinitions || 1095 && (declaration is !VariableDefinitions ||
1095 !declaration.asVariableDefinitions().definitions.nodes.tail.isEmpty())) 1096 !declaration.asVariableDefinitions().definitions.nodes.tail.isEmpty()))
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 1792
1792 TopScope(LibraryElement library) : super(null, library); 1793 TopScope(LibraryElement library) : super(null, library);
1793 Element lookup(SourceString name) { 1794 Element lookup(SourceString name) {
1794 return library.find(name); 1795 return library.find(name);
1795 } 1796 }
1796 1797
1797 Element add(Element element) { 1798 Element add(Element element) {
1798 throw "Cannot add an element in the top scope"; 1799 throw "Cannot add an element in the top scope";
1799 } 1800 }
1800 } 1801 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/scanner/listener.dart » ('j') | frog/leg/ssa/codegen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698