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); |
11 | 11 |
12 R visitAssert(Assert node) => visitStatement(node); | |
13 R visitAsyncForIn(AsyncForIn node) => visitLoop(node); | 12 R visitAsyncForIn(AsyncForIn node) => visitLoop(node); |
14 R visitAsyncModifier(AsyncModifier node) => visitNode(node); | 13 R visitAsyncModifier(AsyncModifier node) => visitNode(node); |
15 R visitAwait(Await node) => visitExpression(node); | 14 R visitAwait(Await node) => visitExpression(node); |
16 R visitBlock(Block node) => visitStatement(node); | 15 R visitBlock(Block node) => visitStatement(node); |
17 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); | 16 R visitBreakStatement(BreakStatement node) => visitGotoStatement(node); |
18 R visitCascade(Cascade node) => visitExpression(node); | 17 R visitCascade(Cascade node) => visitExpression(node); |
19 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); | 18 R visitCascadeReceiver(CascadeReceiver node) => visitExpression(node); |
20 R visitCaseMatch(CaseMatch node) => visitNode(node); | 19 R visitCaseMatch(CaseMatch node) => visitNode(node); |
21 R visitCatchBlock(CatchBlock node) => visitNode(node); | 20 R visitCatchBlock(CatchBlock node) => visitNode(node); |
22 R visitClassNode(ClassNode node) => visitNode(node); | 21 R visitClassNode(ClassNode node) => visitNode(node); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 toDebugString() { | 139 toDebugString() { |
141 return PrettyPrinter.prettyPrint(this); | 140 return PrettyPrinter.prettyPrint(this); |
142 } | 141 } |
143 | 142 |
144 String getObjectDescription() => super.toString(); | 143 String getObjectDescription() => super.toString(); |
145 | 144 |
146 Token getBeginToken(); | 145 Token getBeginToken(); |
147 | 146 |
148 Token getEndToken(); | 147 Token getEndToken(); |
149 | 148 |
150 Assert asAssert() => null; | |
151 AsyncModifier asAsyncModifier() => null; | 149 AsyncModifier asAsyncModifier() => null; |
152 Await asAwait() => null; | 150 Await asAwait() => null; |
153 Block asBlock() => null; | 151 Block asBlock() => null; |
154 BreakStatement asBreakStatement() => null; | 152 BreakStatement asBreakStatement() => null; |
155 Cascade asCascade() => null; | 153 Cascade asCascade() => null; |
156 CascadeReceiver asCascadeReceiver() => null; | 154 CascadeReceiver asCascadeReceiver() => null; |
157 CaseMatch asCaseMatch() => null; | 155 CaseMatch asCaseMatch() => null; |
158 CatchBlock asCatchBlock() => null; | 156 CatchBlock asCatchBlock() => null; |
159 ClassNode asClassNode() => null; | 157 ClassNode asClassNode() => null; |
160 Combinator asCombinator() => null; | 158 Combinator asCombinator() => null; |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 | 1204 |
1207 visitChildren(Visitor visitor) { | 1205 visitChildren(Visitor visitor) { |
1208 expression.accept(visitor); | 1206 expression.accept(visitor); |
1209 } | 1207 } |
1210 | 1208 |
1211 Token getBeginToken() => awaitToken; | 1209 Token getBeginToken() => awaitToken; |
1212 | 1210 |
1213 Token getEndToken() => expression.getEndToken(); | 1211 Token getEndToken() => expression.getEndToken(); |
1214 } | 1212 } |
1215 | 1213 |
1216 class Assert extends Statement { | |
1217 final Token assertToken; | |
1218 final Expression condition; | |
1219 /** Message may be `null`. */ | |
1220 final Expression message; | |
1221 final Token semicolonToken; | |
1222 | |
1223 Assert(this.assertToken, this.condition, this.message, this.semicolonToken); | |
1224 | |
1225 Assert asAssert() => this; | |
1226 | |
1227 bool get hasMessage => message != null; | |
1228 | |
1229 accept(Visitor visitor) => visitor.visitAssert(this); | |
1230 | |
1231 visitChildren(Visitor visitor) { | |
1232 condition.accept(visitor); | |
1233 if (message != null) message.accept(visitor); | |
1234 } | |
1235 | |
1236 Token getBeginToken() => assertToken; | |
1237 Token getEndToken() => semicolonToken; | |
1238 } | |
1239 | |
1240 class Rethrow extends Statement { | 1214 class Rethrow extends Statement { |
1241 final Token throwToken; | 1215 final Token throwToken; |
1242 final Token endToken; | 1216 final Token endToken; |
1243 | 1217 |
1244 Rethrow(this.throwToken, this.endToken); | 1218 Rethrow(this.throwToken, this.endToken); |
1245 | 1219 |
1246 Rethrow asRethrow() => this; | 1220 Rethrow asRethrow() => this; |
1247 | 1221 |
1248 accept(Visitor visitor) => visitor.visitRethrow(this); | 1222 accept(Visitor visitor) => visitor.visitRethrow(this); |
1249 visitChildren(Visitor visitor) { } | 1223 visitChildren(Visitor visitor) { } |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 | 2347 |
2374 // VariableDefinitions. | 2348 // VariableDefinitions. |
2375 get metadata => null; | 2349 get metadata => null; |
2376 get type => null; | 2350 get type => null; |
2377 | 2351 |
2378 // Typedef. | 2352 // Typedef. |
2379 get typeParameters => null; | 2353 get typeParameters => null; |
2380 get formals => null; | 2354 get formals => null; |
2381 get typedefKeyword => null; | 2355 get typedefKeyword => null; |
2382 } | 2356 } |
OLD | NEW |