| 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 Visitor<R> { | 5 interface Visitor<R> { |
| 6 R visitBlock(Block node); | 6 R visitBlock(Block node); |
| 7 R visitBreakStatement(BreakStatement node); | 7 R visitBreakStatement(BreakStatement node); |
| 8 R visitCascade(Cascade node); | 8 R visitCascade(Cascade node); |
| 9 R visitCascadeReceiver(CascadeReceiver node); | 9 R visitCascadeReceiver(CascadeReceiver node); |
| 10 R visitCaseMatch(CaseMatch node); | 10 R visitCaseMatch(CaseMatch node); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 return argumentsNode.getEndToken(); | 298 return argumentsNode.getEndToken(); |
| 299 } | 299 } |
| 300 if (selector !== null) return selector.getEndToken(); | 300 if (selector !== null) return selector.getEndToken(); |
| 301 return receiver.getBeginToken(); | 301 return receiver.getBeginToken(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 Send copyWithReceiver(Node newReceiver) { | 304 Send copyWithReceiver(Node newReceiver) { |
| 305 assert(receiver === null); | 305 assert(receiver === null); |
| 306 return new Send(newReceiver, selector, argumentsNode); | 306 return new Send(newReceiver, selector, argumentsNode); |
| 307 } | 307 } |
| 308 |
| 309 /** |
| 310 * Returns the type annotation of a connstructor call in an object |
| 311 * instantiation. |
| 312 */ |
| 313 TypeAnnotation getTypeAnnotation() { |
| 314 if (selector is TypeAnnotation) { |
| 315 return selector; |
| 316 } else if (selector is Send) { |
| 317 Send selectorSend = selector; |
| 318 if (selectorSend.receiver is TypeAnnotation) { |
| 319 return selectorSend.receiver; |
| 320 } |
| 321 } |
| 322 return null; |
| 323 } |
| 308 } | 324 } |
| 309 | 325 |
| 310 class Postfix extends NodeList { | 326 class Postfix extends NodeList { |
| 311 Postfix() : super(nodes: const EmptyLink<Node>()); | 327 Postfix() : super(nodes: const EmptyLink<Node>()); |
| 312 Postfix.singleton(Node argument) : super.singleton(argument); | 328 Postfix.singleton(Node argument) : super.singleton(argument); |
| 313 } | 329 } |
| 314 | 330 |
| 315 class Prefix extends NodeList { | 331 class Prefix extends NodeList { |
| 316 Prefix() : super(nodes: const EmptyLink<Node>()); | 332 Prefix() : super(nodes: const EmptyLink<Node>()); |
| 317 Prefix.singleton(Node argument) : super.singleton(argument); | 333 Prefix.singleton(Node argument) : super.singleton(argument); |
| (...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 * argument). | 1767 * argument). |
| 1752 * | 1768 * |
| 1753 * TODO(ahe): This method is controversial, the team needs to discuss | 1769 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1754 * if top-level methods are acceptable and what naming conventions to | 1770 * if top-level methods are acceptable and what naming conventions to |
| 1755 * use. | 1771 * use. |
| 1756 */ | 1772 */ |
| 1757 initializerDo(Node node, f(Node node)) { | 1773 initializerDo(Node node, f(Node node)) { |
| 1758 SendSet send = node.asSendSet(); | 1774 SendSet send = node.asSendSet(); |
| 1759 if (send !== null) return f(send.arguments.head); | 1775 if (send !== null) return f(send.arguments.head); |
| 1760 } | 1776 } |
| OLD | NEW |