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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 R visitConstructorReference(Constructor node) => defaultMemberReference(node); | 249 R visitConstructorReference(Constructor node) => defaultMemberReference(node); |
250 R visitProcedureReference(Procedure node) => defaultMemberReference(node); | 250 R visitProcedureReference(Procedure node) => defaultMemberReference(node); |
251 } | 251 } |
252 | 252 |
253 class Visitor<R> extends TreeVisitor<R> | 253 class Visitor<R> extends TreeVisitor<R> |
254 implements DartTypeVisitor<R>, MemberReferenceVisitor<R> { | 254 implements DartTypeVisitor<R>, MemberReferenceVisitor<R> { |
255 /// The catch-all case, except for references. | 255 /// The catch-all case, except for references. |
256 R defaultNode(Node node) => null; | 256 R defaultNode(Node node) => null; |
257 R defaultTreeNode(TreeNode node) => defaultNode(node); | 257 R defaultTreeNode(TreeNode node) => defaultNode(node); |
258 | 258 |
259 /// Inferred values | |
260 R visitInferredValue(InferredValue node) => defaultNode(node); | |
261 | |
262 // DartTypes | 259 // DartTypes |
263 R defaultDartType(DartType node) => defaultNode(node); | 260 R defaultDartType(DartType node) => defaultNode(node); |
264 R visitInvalidType(InvalidType node) => defaultDartType(node); | 261 R visitInvalidType(InvalidType node) => defaultDartType(node); |
265 R visitDynamicType(DynamicType node) => defaultDartType(node); | 262 R visitDynamicType(DynamicType node) => defaultDartType(node); |
266 R visitVoidType(VoidType node) => defaultDartType(node); | 263 R visitVoidType(VoidType node) => defaultDartType(node); |
267 R visitBottomType(BottomType node) => defaultDartType(node); | 264 R visitBottomType(BottomType node) => defaultDartType(node); |
268 R visitInterfaceType(InterfaceType node) => defaultDartType(node); | 265 R visitInterfaceType(InterfaceType node) => defaultDartType(node); |
269 R visitVectorType(VectorType node) => defaultDartType(node); | 266 R visitVectorType(VectorType node) => defaultDartType(node); |
270 R visitFunctionType(FunctionType node) => defaultDartType(node); | 267 R visitFunctionType(FunctionType node) => defaultDartType(node); |
271 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node); | 268 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 defaultStatement(node, arg); | 425 defaultStatement(node, arg); |
429 R visitTryCatch(TryCatch node, arg) => defaultStatement(node, arg); | 426 R visitTryCatch(TryCatch node, arg) => defaultStatement(node, arg); |
430 R visitTryFinally(TryFinally node, arg) => defaultStatement(node, arg); | 427 R visitTryFinally(TryFinally node, arg) => defaultStatement(node, arg); |
431 R visitYieldStatement(YieldStatement node, arg) => | 428 R visitYieldStatement(YieldStatement node, arg) => |
432 defaultStatement(node, arg); | 429 defaultStatement(node, arg); |
433 R visitVariableDeclaration(VariableDeclaration node, arg) => | 430 R visitVariableDeclaration(VariableDeclaration node, arg) => |
434 defaultStatement(node, arg); | 431 defaultStatement(node, arg); |
435 R visitFunctionDeclaration(FunctionDeclaration node, arg) => | 432 R visitFunctionDeclaration(FunctionDeclaration node, arg) => |
436 defaultStatement(node, arg); | 433 defaultStatement(node, arg); |
437 } | 434 } |
OLD | NEW |