| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 bool get isInterface => identical(beginToken.stringValue, 'interface'); | 235 bool get isInterface => identical(beginToken.stringValue, 'interface'); |
| 236 | 236 |
| 237 bool get isClass => !isInterface; | 237 bool get isClass => !isInterface; |
| 238 | 238 |
| 239 Token getBeginToken() => beginToken; | 239 Token getBeginToken() => beginToken; |
| 240 | 240 |
| 241 Token getEndToken() => endToken; | 241 Token getEndToken() => endToken; |
| 242 } | 242 } |
| 243 | 243 |
| 244 class MixinApplication extends Node { | 244 class MixinApplication extends Node { |
| 245 final Modifiers modifiers; | |
| 246 final TypeAnnotation superclass; | 245 final TypeAnnotation superclass; |
| 247 final NodeList mixins; | 246 final NodeList mixins; |
| 248 | 247 |
| 249 MixinApplication(this.modifiers, this.superclass, this.mixins); | 248 MixinApplication(this.superclass, this.mixins); |
| 250 | 249 |
| 251 MixinApplication asMixinApplication() => this; | 250 MixinApplication asMixinApplication() => this; |
| 252 | 251 |
| 253 accept(Visitor visitor) => visitor.visitMixinApplication(this); | 252 accept(Visitor visitor) => visitor.visitMixinApplication(this); |
| 254 | 253 |
| 255 visitChildren(Visitor visitor) { | 254 visitChildren(Visitor visitor) { |
| 256 if (modifiers != null) modifiers.accept(visitor); | |
| 257 if (superclass != null) superclass.accept(visitor); | 255 if (superclass != null) superclass.accept(visitor); |
| 258 if (mixins != null) mixins.accept(visitor); | 256 if (mixins != null) mixins.accept(visitor); |
| 259 } | 257 } |
| 260 | 258 |
| 261 Token getBeginToken() => superclass.getBeginToken(); | 259 Token getBeginToken() => superclass.getBeginToken(); |
| 262 Token getEndToken() => mixins.getEndToken(); | 260 Token getEndToken() => mixins.getEndToken(); |
| 263 } | 261 } |
| 264 | 262 |
| 265 // TODO(kasperl): Let this share some structure with the typedef for function | 263 // TODO(kasperl): Let this share some structure with the typedef for function |
| 266 // type aliases? | 264 // type aliases? |
| 267 class NamedMixinApplication extends Node implements MixinApplication { | 265 class NamedMixinApplication extends Node implements MixinApplication { |
| 268 final Identifier name; | 266 final Identifier name; |
| 269 final NodeList typeParameters; | 267 final NodeList typeParameters; |
| 268 |
| 269 final Modifiers modifiers; |
| 270 final MixinApplication mixinApplication; | 270 final MixinApplication mixinApplication; |
| 271 final NodeList interfaces; |
| 271 | 272 |
| 272 final Token typedefKeyword; | 273 final Token typedefKeyword; |
| 273 final Token endToken; | 274 final Token endToken; |
| 274 | 275 |
| 275 NamedMixinApplication(this.name, this.typeParameters, this.mixinApplication, | 276 NamedMixinApplication(this.name, this.typeParameters, |
| 277 this.modifiers, this.mixinApplication, this.interfaces, |
| 276 this.typedefKeyword, this.endToken); | 278 this.typedefKeyword, this.endToken); |
| 277 | 279 |
| 278 Modifiers get modifiers => mixinApplication.modifiers; | |
| 279 TypeAnnotation get superclass => mixinApplication.superclass; | 280 TypeAnnotation get superclass => mixinApplication.superclass; |
| 280 NodeList get mixins => mixinApplication.mixins; | 281 NodeList get mixins => mixinApplication.mixins; |
| 281 | 282 |
| 282 MixinApplication asMixinApplication() => this; | 283 MixinApplication asMixinApplication() => this; |
| 283 NamedMixinApplication asNamedMixinApplication() => this; | 284 NamedMixinApplication asNamedMixinApplication() => this; |
| 284 | 285 |
| 285 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); | 286 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); |
| 286 | 287 |
| 287 visitChildren(Visitor visitor) { | 288 visitChildren(Visitor visitor) { |
| 288 name.accept(visitor); | 289 name.accept(visitor); |
| 289 if (typeParameters != null) typeParameters.accept(visitor); | 290 if (typeParameters != null) typeParameters.accept(visitor); |
| 291 if (modifiers != null) modifiers.accept(visitor); |
| 292 if (interfaces != null) interfaces.accept(visitor); |
| 290 mixinApplication.accept(visitor); | 293 mixinApplication.accept(visitor); |
| 291 } | 294 } |
| 292 | 295 |
| 293 Token getBeginToken() => typedefKeyword; | 296 Token getBeginToken() => typedefKeyword; |
| 294 Token getEndToken() => endToken; | 297 Token getEndToken() => endToken; |
| 295 } | 298 } |
| 296 | 299 |
| 297 abstract class Expression extends Node { | 300 abstract class Expression extends Node { |
| 298 Expression(); | 301 Expression(); |
| 299 | 302 |
| (...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 * argument). | 2062 * argument). |
| 2060 * | 2063 * |
| 2061 * TODO(ahe): This method is controversial, the team needs to discuss | 2064 * TODO(ahe): This method is controversial, the team needs to discuss |
| 2062 * if top-level methods are acceptable and what naming conventions to | 2065 * if top-level methods are acceptable and what naming conventions to |
| 2063 * use. | 2066 * use. |
| 2064 */ | 2067 */ |
| 2065 initializerDo(Node node, f(Node node)) { | 2068 initializerDo(Node node, f(Node node)) { |
| 2066 SendSet send = node.asSendSet(); | 2069 SendSet send = node.asSendSet(); |
| 2067 if (send != null) return f(send.arguments.head); | 2070 if (send != null) return f(send.arguments.head); |
| 2068 } | 2071 } |
| OLD | NEW |