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

Side by Side Diff: lib/compiler/implementation/resolver.dart

Issue 11066052: Disallow non-identifiers in for-in. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | tests/co19/co19-dart2js.status » ('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) 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 abstract class TreeElements { 5 abstract class TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 DartType getType(TypeAnnotation annotation); 8 DartType getType(TypeAnnotation annotation);
9 bool isParameterChecked(Element element); 9 bool isParameterChecked(Element element);
10 } 10 }
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 const SourceString('hasNext')]) { 2013 const SourceString('hasNext')]) {
2014 registerImplicitInvocation(name, 0); 2014 registerImplicitInvocation(name, 0);
2015 } 2015 }
2016 visit(node.expression); 2016 visit(node.expression);
2017 Scope blockScope = new BlockScope(scope); 2017 Scope blockScope = new BlockScope(scope);
2018 Node declaration = node.declaredIdentifier; 2018 Node declaration = node.declaredIdentifier;
2019 visitIn(declaration, blockScope); 2019 visitIn(declaration, blockScope);
2020 visitLoopBodyIn(node, node.body, blockScope); 2020 visitLoopBodyIn(node, node.body, blockScope);
2021 2021
2022 // TODO(lrn): Also allow a single identifier. 2022 // TODO(lrn): Also allow a single identifier.
2023 if ((declaration is !Send || declaration.asSend().selector is !Identifier) 2023 if ((declaration is !Send || declaration.asSend().selector is !Identifier
2024 || declaration.asSend().receiver != null)
2024 && (declaration is !VariableDefinitions || 2025 && (declaration is !VariableDefinitions ||
2025 !declaration.asVariableDefinitions().definitions.nodes.tail.isEmpty())) 2026 !declaration.asVariableDefinitions().definitions.nodes.tail.isEmpty()))
2026 { 2027 {
2027 // The variable declaration is either not an identifier, not a 2028 // The variable declaration is either not an identifier, not a
2028 // declaration, or it's declaring more than one variable. 2029 // declaration, or it's declaring more than one variable.
2029 error(node.declaredIdentifier, MessageKind.INVALID_FOR_IN, []); 2030 error(node.declaredIdentifier, MessageKind.INVALID_FOR_IN, []);
2030 } 2031 }
2031 } 2032 }
2032 2033
2033 visitLabel(Label node) { 2034 visitLabel(Label node) {
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 return result; 3138 return result;
3138 } 3139 }
3139 Element lookup(SourceString name) => localLookup(name); 3140 Element lookup(SourceString name) => localLookup(name);
3140 Element lexicalLookup(SourceString name) => localLookup(name); 3141 Element lexicalLookup(SourceString name) => localLookup(name);
3141 3142
3142 Element add(Element newElement) { 3143 Element add(Element newElement) {
3143 throw "Cannot add an element in a patch library scope"; 3144 throw "Cannot add an element in a patch library scope";
3144 } 3145 }
3145 String toString() => 'PatchLibraryScope($origin,$patch)'; 3146 String toString() => 'PatchLibraryScope($origin,$patch)';
3146 } 3147 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698