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; | |
6 | |
7 abstract class Visitor<R> { | 5 abstract class Visitor<R> { |
8 const Visitor(); | 6 const Visitor(); |
9 | 7 |
10 abstract R visitNode(Node node); | 8 abstract R visitNode(Node node); |
11 | 9 |
12 R visitBlock(Block node) => visitStatement(node); | 10 R visitBlock(Block node) => visitStatement(node); |
13 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); | 11 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); |
14 R visitCascade(Cascade node) => visitExpression(node); | 12 R visitCascade(Cascade node) => visitExpression(node); |
15 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); | 13 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); |
16 R visitCaseMatch(CaseMatch node) => visitNode(node); | 14 R visitCaseMatch(CaseMatch node) => visitNode(node); |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 * argument). | 2015 * argument). |
2018 * | 2016 * |
2019 * TODO(ahe): This method is controversial, the team needs to discuss | 2017 * TODO(ahe): This method is controversial, the team needs to discuss |
2020 * if top-level methods are acceptable and what naming conventions to | 2018 * if top-level methods are acceptable and what naming conventions to |
2021 * use. | 2019 * use. |
2022 */ | 2020 */ |
2023 initializerDo(Node node, f(Node node)) { | 2021 initializerDo(Node node, f(Node node)) { |
2024 SendSet send = node.asSendSet(); | 2022 SendSet send = node.asSendSet(); |
2025 if (send != null) return f(send.arguments.head); | 2023 if (send != null) return f(send.arguments.head); |
2026 } | 2024 } |
OLD | NEW |