| 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 const Visitor(); | 6 const Visitor(); |
| 7 | 7 |
| 8 abstract R visitNode(Node node); | 8 abstract R visitNode(Node node); |
| 9 | 9 |
| 10 R visitBlock(Block node) => visitStatement(node); | 10 R visitBlock(Block node) => visitStatement(node); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 TypeVariable asTypeVariable() => null; | 194 TypeVariable asTypeVariable() => null; |
| 195 Typedef asTypedef() => null; | 195 Typedef asTypedef() => null; |
| 196 VariableDefinitions asVariableDefinitions() => null; | 196 VariableDefinitions asVariableDefinitions() => null; |
| 197 While asWhile() => null; | 197 While asWhile() => null; |
| 198 | 198 |
| 199 bool isValidBreakTarget() => false; | 199 bool isValidBreakTarget() => false; |
| 200 bool isValidContinueTarget() => false; | 200 bool isValidContinueTarget() => false; |
| 201 } | 201 } |
| 202 | 202 |
| 203 class ClassNode extends Node { | 203 class ClassNode extends Node { |
| 204 final Modifiers modifiers; |
| 204 final Identifier name; | 205 final Identifier name; |
| 205 final TypeAnnotation superclass; | 206 final TypeAnnotation superclass; |
| 206 final NodeList interfaces; | 207 final NodeList interfaces; |
| 207 final NodeList typeParameters; | 208 final NodeList typeParameters; |
| 208 final NodeList body; | 209 final NodeList body; |
| 209 | 210 |
| 210 // TODO(ahe, karlklose): the default keyword is not recorded. | 211 // TODO(ahe, karlklose): the default keyword is not recorded. |
| 211 final TypeAnnotation defaultClause; | 212 final TypeAnnotation defaultClause; |
| 212 | 213 |
| 213 final Token beginToken; | 214 final Token beginToken; |
| 214 final Token extendsKeyword; | 215 final Token extendsKeyword; |
| 215 final Token endToken; | 216 final Token endToken; |
| 216 | 217 |
| 217 ClassNode(this.name, this.typeParameters, this.superclass, this.interfaces, | 218 ClassNode(this.modifiers, this.name, this.typeParameters, this.superclass, |
| 218 this.defaultClause, this.beginToken, this.extendsKeyword, | 219 this.interfaces, this.defaultClause, this.beginToken, |
| 219 this.body, this.endToken); | 220 this.extendsKeyword, this.body, this.endToken); |
| 220 | 221 |
| 221 ClassNode asClassNode() => this; | 222 ClassNode asClassNode() => this; |
| 222 | 223 |
| 223 accept(Visitor visitor) => visitor.visitClassNode(this); | 224 accept(Visitor visitor) => visitor.visitClassNode(this); |
| 224 | 225 |
| 225 visitChildren(Visitor visitor) { | 226 visitChildren(Visitor visitor) { |
| 226 if (name !== null) name.accept(visitor); | 227 if (name !== null) name.accept(visitor); |
| 227 if (typeParameters !== null) typeParameters.accept(visitor); | 228 if (typeParameters !== null) typeParameters.accept(visitor); |
| 228 if (superclass !== null) superclass.accept(visitor); | 229 if (superclass !== null) superclass.accept(visitor); |
| 229 if (interfaces !== null) interfaces.accept(visitor); | 230 if (interfaces !== null) interfaces.accept(visitor); |
| (...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 * argument). | 1980 * argument). |
| 1980 * | 1981 * |
| 1981 * TODO(ahe): This method is controversial, the team needs to discuss | 1982 * TODO(ahe): This method is controversial, the team needs to discuss |
| 1982 * if top-level methods are acceptable and what naming conventions to | 1983 * if top-level methods are acceptable and what naming conventions to |
| 1983 * use. | 1984 * use. |
| 1984 */ | 1985 */ |
| 1985 initializerDo(Node node, f(Node node)) { | 1986 initializerDo(Node node, f(Node node)) { |
| 1986 SendSet send = node.asSendSet(); | 1987 SendSet send = node.asSendSet(); |
| 1987 if (send !== null) return f(send.arguments.head); | 1988 if (send !== null) return f(send.arguments.head); |
| 1988 } | 1989 } |
| OLD | NEW |