| 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 R visitNode(Node node); | 10 R visitNode(Node node); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 } | 534 } |
| 535 | 535 |
| 536 Node get last { | 536 Node get last { |
| 537 return Collections.last(this); | 537 return Collections.last(this); |
| 538 } | 538 } |
| 539 | 539 |
| 540 Node get single { | 540 Node get single { |
| 541 return Collections.single(this); | 541 return Collections.single(this); |
| 542 } | 542 } |
| 543 | 543 |
| 544 Node min([int compare(Node a, Node b)]) => Collections.min(this, compare); |
| 545 |
| 546 Node max([int compare(Node a, Node b)]) => Collections.max(this, compare); |
| 547 |
| 544 Node firstMatching(bool test(Node value), {Node orElse()}) { | 548 Node firstMatching(bool test(Node value), {Node orElse()}) { |
| 545 return Collections.firstMatching(this, test, orElse); | 549 return Collections.firstMatching(this, test, orElse); |
| 546 } | 550 } |
| 547 | 551 |
| 548 Node lastMatching(bool test(Node value), {Node orElse()}) { | 552 Node lastMatching(bool test(Node value), {Node orElse()}) { |
| 549 return Collections.lastMatching(this, test, orElse); | 553 return Collections.lastMatching(this, test, orElse); |
| 550 } | 554 } |
| 551 | 555 |
| 552 Node singleMatching(bool test(Node value)) { | 556 Node singleMatching(bool test(Node value)) { |
| 553 return Collections.singleMatching(this, test); | 557 return Collections.singleMatching(this, test); |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 * argument). | 2089 * argument). |
| 2086 * | 2090 * |
| 2087 * TODO(ahe): This method is controversial, the team needs to discuss | 2091 * TODO(ahe): This method is controversial, the team needs to discuss |
| 2088 * if top-level methods are acceptable and what naming conventions to | 2092 * if top-level methods are acceptable and what naming conventions to |
| 2089 * use. | 2093 * use. |
| 2090 */ | 2094 */ |
| 2091 initializerDo(Node node, f(Node node)) { | 2095 initializerDo(Node node, f(Node node)) { |
| 2092 SendSet send = node.asSendSet(); | 2096 SendSet send = node.asSendSet(); |
| 2093 if (send != null) return f(send.arguments.head); | 2097 if (send != null) return f(send.arguments.head); |
| 2094 } | 2098 } |
| OLD | NEW |