OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.ast.visitor; | 4 library kernel.ast.visitor; |
5 | 5 |
6 import 'ast.dart'; | 6 import 'ast.dart'; |
7 | 7 |
8 abstract class ExpressionVisitor<R> { | 8 abstract class ExpressionVisitor<R> { |
9 R defaultExpression(Expression node) => null; | 9 R defaultExpression(Expression node) => null; |
10 R defaultBasicLiteral(BasicLiteral node) => defaultExpression(node); | 10 R defaultBasicLiteral(BasicLiteral node) => defaultExpression(node); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 /// By default, recursion stops at this point. | 311 /// By default, recursion stops at this point. |
312 DartType visitDartType(DartType node) => node; | 312 DartType visitDartType(DartType node) => node; |
313 | 313 |
314 Supertype visitSupertype(Supertype node) => node; | 314 Supertype visitSupertype(Supertype node) => node; |
315 | 315 |
316 TreeNode defaultTreeNode(TreeNode node) { | 316 TreeNode defaultTreeNode(TreeNode node) { |
317 node.transformChildren(this); | 317 node.transformChildren(this); |
318 return node; | 318 return node; |
319 } | 319 } |
320 } | 320 } |
| 321 |
| 322 abstract class ExpressionVisitor1<R> { |
| 323 R defaultExpression(Expression node, arg) => null; |
| 324 R defaultBasicLiteral(BasicLiteral node, arg) => defaultExpression(node, arg); |
| 325 R visitInvalidExpression(InvalidExpression node, arg) => |
| 326 defaultExpression(node, arg); |
| 327 R visitVariableGet(VariableGet node, arg) => defaultExpression(node, arg); |
| 328 R visitVariableSet(VariableSet node, arg) => defaultExpression(node, arg); |
| 329 R visitPropertyGet(PropertyGet node, arg) => defaultExpression(node, arg); |
| 330 R visitPropertySet(PropertySet node, arg) => defaultExpression(node, arg); |
| 331 R visitDirectPropertyGet(DirectPropertyGet node, arg) => |
| 332 defaultExpression(node, arg); |
| 333 R visitDirectPropertySet(DirectPropertySet node, arg) => |
| 334 defaultExpression(node, arg); |
| 335 R visitSuperPropertyGet(SuperPropertyGet node, arg) => |
| 336 defaultExpression(node, arg); |
| 337 R visitSuperPropertySet(SuperPropertySet node, arg) => |
| 338 defaultExpression(node, arg); |
| 339 R visitStaticGet(StaticGet node, arg) => defaultExpression(node, arg); |
| 340 R visitStaticSet(StaticSet node, arg) => defaultExpression(node, arg); |
| 341 R visitMethodInvocation(MethodInvocation node, arg) => |
| 342 defaultExpression(node, arg); |
| 343 R visitDirectMethodInvocation(DirectMethodInvocation node, arg) => |
| 344 defaultExpression(node, arg); |
| 345 R visitSuperMethodInvocation(SuperMethodInvocation node, arg) => |
| 346 defaultExpression(node, arg); |
| 347 R visitStaticInvocation(StaticInvocation node, arg) => |
| 348 defaultExpression(node, arg); |
| 349 R visitConstructorInvocation(ConstructorInvocation node, arg) => |
| 350 defaultExpression(node, arg); |
| 351 R visitNot(Not node, arg) => defaultExpression(node, arg); |
| 352 R visitLogicalExpression(LogicalExpression node, arg) => |
| 353 defaultExpression(node, arg); |
| 354 R visitConditionalExpression(ConditionalExpression node, arg) => |
| 355 defaultExpression(node, arg); |
| 356 R visitStringConcatenation(StringConcatenation node, arg) => |
| 357 defaultExpression(node, arg); |
| 358 R visitIsExpression(IsExpression node, arg) => defaultExpression(node, arg); |
| 359 R visitAsExpression(AsExpression node, arg) => defaultExpression(node, arg); |
| 360 R visitSymbolLiteral(SymbolLiteral node, arg) => defaultExpression(node, arg); |
| 361 R visitTypeLiteral(TypeLiteral node, arg) => defaultExpression(node, arg); |
| 362 R visitThisExpression(ThisExpression node, arg) => |
| 363 defaultExpression(node, arg); |
| 364 R visitRethrow(Rethrow node, arg) => defaultExpression(node, arg); |
| 365 R visitThrow(Throw node, arg) => defaultExpression(node, arg); |
| 366 R visitListLiteral(ListLiteral node, arg) => defaultExpression(node, arg); |
| 367 R visitMapLiteral(MapLiteral node, arg) => defaultExpression(node, arg); |
| 368 R visitAwaitExpression(AwaitExpression node, arg) => |
| 369 defaultExpression(node, arg); |
| 370 R visitFunctionExpression(FunctionExpression node, arg) => |
| 371 defaultExpression(node, arg); |
| 372 R visitStringLiteral(StringLiteral node, arg) => |
| 373 defaultBasicLiteral(node, arg); |
| 374 R visitIntLiteral(IntLiteral node, arg) => defaultBasicLiteral(node, arg); |
| 375 R visitDoubleLiteral(DoubleLiteral node, arg) => |
| 376 defaultBasicLiteral(node, arg); |
| 377 R visitBoolLiteral(BoolLiteral node, arg) => defaultBasicLiteral(node, arg); |
| 378 R visitNullLiteral(NullLiteral node, arg) => defaultBasicLiteral(node, arg); |
| 379 R visitLet(Let node, arg) => defaultExpression(node, arg); |
| 380 R visitLoadLibrary(LoadLibrary node, arg) => defaultExpression(node, arg); |
| 381 R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, arg) => |
| 382 defaultExpression(node, arg); |
| 383 } |
OLD | NEW |