| 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 part of tree; | 5 part of tree; |
| 6 | 6 |
| 7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
| 8 const Visitor(); | 8 const Visitor(); |
| 9 | 9 |
| 10 abstract R visitNode(Node node); | 10 abstract R visitNode(Node node); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return argumentsNode.getEndToken(); | 325 return argumentsNode.getEndToken(); |
| 326 } | 326 } |
| 327 if (selector != null) return selector.getEndToken(); | 327 if (selector != null) return selector.getEndToken(); |
| 328 return receiver.getBeginToken(); | 328 return receiver.getBeginToken(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 Send copyWithReceiver(Node newReceiver) { | 331 Send copyWithReceiver(Node newReceiver) { |
| 332 assert(receiver == null); | 332 assert(receiver == null); |
| 333 return new Send(newReceiver, selector, argumentsNode); | 333 return new Send(newReceiver, selector, argumentsNode); |
| 334 } | 334 } |
| 335 | |
| 336 /** | |
| 337 * Returns the type annotation of a connstructor call in an object | |
| 338 * instantiation. | |
| 339 */ | |
| 340 TypeAnnotation getTypeAnnotation() { | |
| 341 if (selector is TypeAnnotation) { | |
| 342 return selector; | |
| 343 } else if (selector is Send) { | |
| 344 Send selectorSend = selector; | |
| 345 if (selectorSend.receiver is TypeAnnotation) { | |
| 346 return selectorSend.receiver; | |
| 347 } | |
| 348 } | |
| 349 return null; | |
| 350 } | |
| 351 } | 335 } |
| 352 | 336 |
| 353 class Postfix extends NodeList { | 337 class Postfix extends NodeList { |
| 354 Postfix() : super(null, const Link<Node>()); | 338 Postfix() : super(null, const Link<Node>()); |
| 355 Postfix.singleton(Node argument) : super.singleton(argument); | 339 Postfix.singleton(Node argument) : super.singleton(argument); |
| 356 } | 340 } |
| 357 | 341 |
| 358 class Prefix extends NodeList { | 342 class Prefix extends NodeList { |
| 359 Prefix() : super(null, const Link<Node>()); | 343 Prefix() : super(null, const Link<Node>()); |
| 360 Prefix.singleton(Node argument) : super.singleton(argument); | 344 Prefix.singleton(Node argument) : super.singleton(argument); |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 * argument). | 1995 * argument). |
| 2012 * | 1996 * |
| 2013 * TODO(ahe): This method is controversial, the team needs to discuss | 1997 * TODO(ahe): This method is controversial, the team needs to discuss |
| 2014 * if top-level methods are acceptable and what naming conventions to | 1998 * if top-level methods are acceptable and what naming conventions to |
| 2015 * use. | 1999 * use. |
| 2016 */ | 2000 */ |
| 2017 initializerDo(Node node, f(Node node)) { | 2001 initializerDo(Node node, f(Node node)) { |
| 2018 SendSet send = node.asSendSet(); | 2002 SendSet send = node.asSendSet(); |
| 2019 if (send != null) return f(send.arguments.head); | 2003 if (send != null) return f(send.arguments.head); |
| 2020 } | 2004 } |
| OLD | NEW |