| 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 abstract class Visitor<R> { | 5 abstract class 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 * A node in a syntax tree. | 77 * A node in a syntax tree. |
| 78 * | 78 * |
| 79 * The abstract part of "abstract syntax tree" is invalidated when | 79 * The abstract part of "abstract syntax tree" is invalidated when |
| 80 * supporting tools such as code formatting. These tools need concrete | 80 * supporting tools such as code formatting. These tools need concrete |
| 81 * syntax such as parentheses and no constant folding. | 81 * syntax such as parentheses and no constant folding. |
| 82 * | 82 * |
| 83 * We support these tools by storing additional references back to the | 83 * We support these tools by storing additional references back to the |
| 84 * token stream. These references are stored in fields ending with | 84 * token stream. These references are stored in fields ending with |
| 85 * "Token". | 85 * "Token". |
| 86 */ | 86 */ |
| 87 class Node implements Hashable, Spannable { | 87 class Node implements Spannable { |
| 88 final int _hashCode; | 88 final int _hashCode; |
| 89 static int _HASH_COUNTER = 0; | 89 static int _HASH_COUNTER = 0; |
| 90 | 90 |
| 91 Node() : _hashCode = ++_HASH_COUNTER; | 91 Node() : _hashCode = ++_HASH_COUNTER; |
| 92 | 92 |
| 93 hashCode() => _hashCode; | 93 hashCode() => _hashCode; |
| 94 | 94 |
| 95 abstract accept(Visitor visitor); | 95 abstract accept(Visitor visitor); |
| 96 | 96 |
| 97 abstract visitChildren(Visitor visitor); | 97 abstract visitChildren(Visitor visitor); |
| (...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 * argument). | 1893 * argument). |
| 1894 * | 1894 * |
| 1895 * TODO(ahe): This method is controversial, the team needs to discuss | 1895 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1896 * if top-level methods are acceptable and what naming conventions to | 1896 * if top-level methods are acceptable and what naming conventions to |
| 1897 * use. | 1897 * use. |
| 1898 */ | 1898 */ |
| 1899 initializerDo(Node node, f(Node node)) { | 1899 initializerDo(Node node, f(Node node)) { |
| 1900 SendSet send = node.asSendSet(); | 1900 SendSet send = node.asSendSet(); |
| 1901 if (send !== null) return f(send.arguments.head); | 1901 if (send !== null) return f(send.arguments.head); |
| 1902 } | 1902 } |
| OLD | NEW |