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

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

Issue 10854191: Require two type arguments for map literals (issue 4522). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
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 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 } 1593 }
1594 } 1594 }
1595 1595
1596 visitLabel(Label node) { 1596 visitLabel(Label node) {
1597 // Labels are handled by their containing statements/cases. 1597 // Labels are handled by their containing statements/cases.
1598 } 1598 }
1599 1599
1600 visitLabeledStatement(LabeledStatement node) { 1600 visitLabeledStatement(LabeledStatement node) {
1601 Statement body = node.statement; 1601 Statement body = node.statement;
1602 TargetElement targetElement = getOrCreateTargetElement(body); 1602 TargetElement targetElement = getOrCreateTargetElement(body);
1603 Map<String, LabelElement> labelElements = <LabelElement>{}; 1603 Map<String, LabelElement> labelElements = <String, LabelElement>{};
1604 for (Label label in node.labels) { 1604 for (Label label in node.labels) {
1605 String labelName = label.slowToString(); 1605 String labelName = label.slowToString();
1606 if (labelElements.containsKey(labelName)) continue; 1606 if (labelElements.containsKey(labelName)) continue;
1607 LabelElement element = targetElement.addLabel(label, labelName); 1607 LabelElement element = targetElement.addLabel(label, labelName);
1608 labelElements[labelName] = element; 1608 labelElements[labelName] = element;
1609 } 1609 }
1610 statementScope.enterLabelScope(labelElements); 1610 statementScope.enterLabelScope(labelElements);
1611 visit(node.statement); 1611 visit(node.statement);
1612 statementScope.exitLabelScope(); 1612 statementScope.exitLabelScope();
1613 labelElements.forEach((String labelName, LabelElement element) { 1613 labelElements.forEach((String labelName, LabelElement element) {
(...skipping 19 matching lines...) Expand all
1633 } 1633 }
1634 1634
1635 visitNamedArgument(NamedArgument node) { 1635 visitNamedArgument(NamedArgument node) {
1636 visit(node.expression); 1636 visit(node.expression);
1637 } 1637 }
1638 1638
1639 visitSwitchStatement(SwitchStatement node) { 1639 visitSwitchStatement(SwitchStatement node) {
1640 node.expression.accept(this); 1640 node.expression.accept(this);
1641 1641
1642 TargetElement breakElement = getOrCreateTargetElement(node); 1642 TargetElement breakElement = getOrCreateTargetElement(node);
1643 Map<String, LabelElement> continueLabels = <LabelElement>{}; 1643 Map<String, LabelElement> continueLabels = <String, LabelElement>{};
1644 Link<Node> cases = node.cases.nodes; 1644 Link<Node> cases = node.cases.nodes;
1645 while (!cases.isEmpty()) { 1645 while (!cases.isEmpty()) {
1646 SwitchCase switchCase = cases.head; 1646 SwitchCase switchCase = cases.head;
1647 for (Node labelOrCase in switchCase.labelsAndCases) { 1647 for (Node labelOrCase in switchCase.labelsAndCases) {
1648 if (labelOrCase is! Label) continue; 1648 if (labelOrCase is! Label) continue;
1649 Label label = labelOrCase; 1649 Label label = labelOrCase;
1650 String labelName = label.slowToString(); 1650 String labelName = label.slowToString();
1651 1651
1652 LabelElement existingElement = continueLabels[labelName]; 1652 LabelElement existingElement = continueLabels[labelName];
1653 if (existingElement !== null) { 1653 if (existingElement !== null) {
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
2439 TopScope(LibraryElement library) : super(null, library); 2439 TopScope(LibraryElement library) : super(null, library);
2440 Element lookup(SourceString name) { 2440 Element lookup(SourceString name) {
2441 return library.find(name); 2441 return library.find(name);
2442 } 2442 }
2443 2443
2444 Element add(Element newElement) { 2444 Element add(Element newElement) {
2445 throw "Cannot add an element in the top scope"; 2445 throw "Cannot add an element in the top scope";
2446 } 2446 }
2447 String toString() => '$element'; 2447 String toString() => '$element';
2448 } 2448 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/library_map.dart ('k') | lib/compiler/implementation/scanner/partial_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698