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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 class ClassNode extends Node { | 208 class ClassNode extends Node { |
209 final Modifiers modifiers; | 209 final Modifiers modifiers; |
210 final Identifier name; | 210 final Identifier name; |
211 final Node superclass; | 211 final Node superclass; |
212 final NodeList interfaces; | 212 final NodeList interfaces; |
213 final NodeList typeParameters; | 213 final NodeList typeParameters; |
214 final NodeList body; | 214 final NodeList body; |
215 | 215 |
216 // TODO(ahe, karlklose): the default keyword is not recorded. | |
217 final TypeAnnotation defaultClause; | |
218 | |
219 final Token beginToken; | 216 final Token beginToken; |
220 final Token extendsKeyword; | 217 final Token extendsKeyword; |
221 final Token endToken; | 218 final Token endToken; |
222 | 219 |
223 ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass, | 220 ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass, |
224 this.interfaces, this.defaultClause, this.beginToken, | 221 this.interfaces, this.beginToken, |
225 this.extendsKeyword, this.body, this.endToken); | 222 this.extendsKeyword, this.body, this.endToken); |
226 | 223 |
227 ClassNode asClassNode() => this; | 224 ClassNode asClassNode() => this; |
228 | 225 |
229 accept(Visitor visitor) => visitor.visitClassNode(this); | 226 accept(Visitor visitor) => visitor.visitClassNode(this); |
230 | 227 |
231 visitChildren(Visitor visitor) { | 228 visitChildren(Visitor visitor) { |
232 if (name != null) name.accept(visitor); | 229 if (name != null) name.accept(visitor); |
233 if (typeParameters != null) typeParameters.accept(visitor); | 230 if (typeParameters != null) typeParameters.accept(visitor); |
234 if (superclass != null) superclass.accept(visitor); | 231 if (superclass != null) superclass.accept(visitor); |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 * argument). | 2085 * argument). |
2089 * | 2086 * |
2090 * TODO(ahe): This method is controversial, the team needs to discuss | 2087 * TODO(ahe): This method is controversial, the team needs to discuss |
2091 * if top-level methods are acceptable and what naming conventions to | 2088 * if top-level methods are acceptable and what naming conventions to |
2092 * use. | 2089 * use. |
2093 */ | 2090 */ |
2094 initializerDo(Node node, f(Node node)) { | 2091 initializerDo(Node node, f(Node node)) { |
2095 SendSet send = node.asSendSet(); | 2092 SendSet send = node.asSendSet(); |
2096 if (send != null) return f(send.arguments.head); | 2093 if (send != null) return f(send.arguments.head); |
2097 } | 2094 } |
OLD | NEW |