OLD | NEW |
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 DartType getType(TypeAnnotation annotation); | 8 DartType getType(TypeAnnotation annotation); |
9 bool isParameterChecked(Element element); | 9 bool isParameterChecked(Element element); |
10 } | 10 } |
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 class SignatureResolver extends CommonResolverVisitor<Element> { | 2318 class SignatureResolver extends CommonResolverVisitor<Element> { |
2319 final Element enclosingElement; | 2319 final Element enclosingElement; |
2320 Link<Element> optionalParameters = const EmptyLink<Element>(); | 2320 Link<Element> optionalParameters = const EmptyLink<Element>(); |
2321 int optionalParameterCount = 0; | 2321 int optionalParameterCount = 0; |
2322 VariableDefinitions currentDefinitions; | 2322 VariableDefinitions currentDefinitions; |
2323 | 2323 |
2324 SignatureResolver(Compiler compiler, this.enclosingElement) : super(compiler); | 2324 SignatureResolver(Compiler compiler, this.enclosingElement) : super(compiler); |
2325 | 2325 |
2326 Element visitNodeList(NodeList node) { | 2326 Element visitNodeList(NodeList node) { |
2327 // This must be a list of optional arguments. | 2327 // This must be a list of optional arguments. |
2328 if (node.beginToken.stringValue !== '[') { | 2328 String value = node.beginToken.stringValue; |
| 2329 if ((value !== '[') && (value !== '{')) { |
2329 internalError(node, "expected optional parameters"); | 2330 internalError(node, "expected optional parameters"); |
2330 } | 2331 } |
2331 LinkBuilder<Element> elements = analyzeNodes(node.nodes); | 2332 LinkBuilder<Element> elements = analyzeNodes(node.nodes); |
2332 optionalParameterCount = elements.length; | 2333 optionalParameterCount = elements.length; |
2333 optionalParameters = elements.toLink(); | 2334 optionalParameters = elements.toLink(); |
2334 return null; | 2335 return null; |
2335 } | 2336 } |
2336 | 2337 |
2337 Element visitVariableDefinitions(VariableDefinitions node) { | 2338 Element visitVariableDefinitions(VariableDefinitions node) { |
2338 Link<Node> definitions = node.definitions.nodes; | 2339 Link<Node> definitions = node.definitions.nodes; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 | 2752 |
2752 Element localLookup(SourceString name) => library.find(name); | 2753 Element localLookup(SourceString name) => library.find(name); |
2753 Element lookup(SourceString name) => localLookup(name); | 2754 Element lookup(SourceString name) => localLookup(name); |
2754 Element lexicalLookup(SourceString name) => localLookup(name); | 2755 Element lexicalLookup(SourceString name) => localLookup(name); |
2755 | 2756 |
2756 Element add(Element newElement) { | 2757 Element add(Element newElement) { |
2757 throw "Cannot add an element in the top scope"; | 2758 throw "Cannot add an element in the top scope"; |
2758 } | 2759 } |
2759 String toString() => '$element'; | 2760 String toString() => '$element'; |
2760 } | 2761 } |
OLD | NEW |