Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: pkg/kernel/lib/visitor.dart

Issue 2825053002: Add typedef AST node boilerplate. (Closed)
Patch Set: Update FastaVerifyingVisitor to work with the changes in VerifyingVisitor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/kernel/lib/verifier.dart ('k') | pkg/kernel/test/type_parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 defaultInitializer(node); 214 defaultInitializer(node);
215 R visitFieldInitializer(FieldInitializer node) => defaultInitializer(node); 215 R visitFieldInitializer(FieldInitializer node) => defaultInitializer(node);
216 R visitSuperInitializer(SuperInitializer node) => defaultInitializer(node); 216 R visitSuperInitializer(SuperInitializer node) => defaultInitializer(node);
217 R visitRedirectingInitializer(RedirectingInitializer node) => 217 R visitRedirectingInitializer(RedirectingInitializer node) =>
218 defaultInitializer(node); 218 defaultInitializer(node);
219 R visitLocalInitializer(LocalInitializer node) => defaultInitializer(node); 219 R visitLocalInitializer(LocalInitializer node) => defaultInitializer(node);
220 220
221 // Other tree nodes 221 // Other tree nodes
222 R visitLibrary(Library node) => defaultTreeNode(node); 222 R visitLibrary(Library node) => defaultTreeNode(node);
223 R visitDeferredImport(DeferredImport node) => defaultTreeNode(node); 223 R visitDeferredImport(DeferredImport node) => defaultTreeNode(node);
224 R visitTypedef(Typedef node) => defaultTreeNode(node);
224 R visitTypeParameter(TypeParameter node) => defaultTreeNode(node); 225 R visitTypeParameter(TypeParameter node) => defaultTreeNode(node);
225 R visitFunctionNode(FunctionNode node) => defaultTreeNode(node); 226 R visitFunctionNode(FunctionNode node) => defaultTreeNode(node);
226 R visitArguments(Arguments node) => defaultTreeNode(node); 227 R visitArguments(Arguments node) => defaultTreeNode(node);
227 R visitNamedExpression(NamedExpression node) => defaultTreeNode(node); 228 R visitNamedExpression(NamedExpression node) => defaultTreeNode(node);
228 R visitSwitchCase(SwitchCase node) => defaultTreeNode(node); 229 R visitSwitchCase(SwitchCase node) => defaultTreeNode(node);
229 R visitCatch(Catch node) => defaultTreeNode(node); 230 R visitCatch(Catch node) => defaultTreeNode(node);
230 R visitMapEntry(MapEntry node) => defaultTreeNode(node); 231 R visitMapEntry(MapEntry node) => defaultTreeNode(node);
231 R visitProgram(Program node) => defaultTreeNode(node); 232 R visitProgram(Program node) => defaultTreeNode(node);
232 } 233 }
233 234
234 class DartTypeVisitor<R> { 235 class DartTypeVisitor<R> {
235 R defaultDartType(DartType node) => null; 236 R defaultDartType(DartType node) => null;
236 237
237 R visitInvalidType(InvalidType node) => defaultDartType(node); 238 R visitInvalidType(InvalidType node) => defaultDartType(node);
238 R visitDynamicType(DynamicType node) => defaultDartType(node); 239 R visitDynamicType(DynamicType node) => defaultDartType(node);
239 R visitVoidType(VoidType node) => defaultDartType(node); 240 R visitVoidType(VoidType node) => defaultDartType(node);
240 R visitBottomType(BottomType node) => defaultDartType(node); 241 R visitBottomType(BottomType node) => defaultDartType(node);
241 R visitInterfaceType(InterfaceType node) => defaultDartType(node); 242 R visitInterfaceType(InterfaceType node) => defaultDartType(node);
242 R visitVectorType(VectorType node) => defaultDartType(node); 243 R visitVectorType(VectorType node) => defaultDartType(node);
243 R visitFunctionType(FunctionType node) => defaultDartType(node); 244 R visitFunctionType(FunctionType node) => defaultDartType(node);
244 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node); 245 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node);
246 R visitTypedefType(TypedefType node) => defaultDartType(node);
245 } 247 }
246 248
247 class MemberReferenceVisitor<R> { 249 class MemberReferenceVisitor<R> {
248 R defaultMemberReference(Member node) => null; 250 R defaultMemberReference(Member node) => null;
249 251
250 R visitFieldReference(Field node) => defaultMemberReference(node); 252 R visitFieldReference(Field node) => defaultMemberReference(node);
251 R visitConstructorReference(Constructor node) => defaultMemberReference(node); 253 R visitConstructorReference(Constructor node) => defaultMemberReference(node);
252 R visitProcedureReference(Procedure node) => defaultMemberReference(node); 254 R visitProcedureReference(Procedure node) => defaultMemberReference(node);
253 } 255 }
254 256
255 class Visitor<R> extends TreeVisitor<R> 257 class Visitor<R> extends TreeVisitor<R>
256 implements DartTypeVisitor<R>, MemberReferenceVisitor<R> { 258 implements DartTypeVisitor<R>, MemberReferenceVisitor<R> {
257 /// The catch-all case, except for references. 259 /// The catch-all case, except for references.
258 R defaultNode(Node node) => null; 260 R defaultNode(Node node) => null;
259 R defaultTreeNode(TreeNode node) => defaultNode(node); 261 R defaultTreeNode(TreeNode node) => defaultNode(node);
260 262
261 // DartTypes 263 // DartTypes
262 R defaultDartType(DartType node) => defaultNode(node); 264 R defaultDartType(DartType node) => defaultNode(node);
263 R visitInvalidType(InvalidType node) => defaultDartType(node); 265 R visitInvalidType(InvalidType node) => defaultDartType(node);
264 R visitDynamicType(DynamicType node) => defaultDartType(node); 266 R visitDynamicType(DynamicType node) => defaultDartType(node);
265 R visitVoidType(VoidType node) => defaultDartType(node); 267 R visitVoidType(VoidType node) => defaultDartType(node);
266 R visitBottomType(BottomType node) => defaultDartType(node); 268 R visitBottomType(BottomType node) => defaultDartType(node);
267 R visitInterfaceType(InterfaceType node) => defaultDartType(node); 269 R visitInterfaceType(InterfaceType node) => defaultDartType(node);
268 R visitVectorType(VectorType node) => defaultDartType(node); 270 R visitVectorType(VectorType node) => defaultDartType(node);
269 R visitFunctionType(FunctionType node) => defaultDartType(node); 271 R visitFunctionType(FunctionType node) => defaultDartType(node);
270 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node); 272 R visitTypeParameterType(TypeParameterType node) => defaultDartType(node);
273 R visitTypedefType(TypedefType node) => defaultDartType(node);
271 274
272 // Class references 275 // Class references
273 R visitClassReference(Class node) => null; 276 R visitClassReference(Class node) => null;
277 R visitTypedefReference(Typedef node) => null;
274 278
275 // Member references 279 // Member references
276 R defaultMemberReference(Member node) => null; 280 R defaultMemberReference(Member node) => null;
277 R visitFieldReference(Field node) => defaultMemberReference(node); 281 R visitFieldReference(Field node) => defaultMemberReference(node);
278 R visitConstructorReference(Constructor node) => defaultMemberReference(node); 282 R visitConstructorReference(Constructor node) => defaultMemberReference(node);
279 R visitProcedureReference(Procedure node) => defaultMemberReference(node); 283 R visitProcedureReference(Procedure node) => defaultMemberReference(node);
280 284
281 R visitName(Name node) => defaultNode(node); 285 R visitName(Name node) => defaultNode(node);
282 R visitSupertype(Supertype node) => defaultNode(node); 286 R visitSupertype(Supertype node) => defaultNode(node);
283 R visitNamedType(NamedType node) => defaultNode(node); 287 R visitNamedType(NamedType node) => defaultNode(node);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 defaultStatement(node, arg); 435 defaultStatement(node, arg);
432 R visitTryCatch(TryCatch node, T arg) => defaultStatement(node, arg); 436 R visitTryCatch(TryCatch node, T arg) => defaultStatement(node, arg);
433 R visitTryFinally(TryFinally node, T arg) => defaultStatement(node, arg); 437 R visitTryFinally(TryFinally node, T arg) => defaultStatement(node, arg);
434 R visitYieldStatement(YieldStatement node, T arg) => 438 R visitYieldStatement(YieldStatement node, T arg) =>
435 defaultStatement(node, arg); 439 defaultStatement(node, arg);
436 R visitVariableDeclaration(VariableDeclaration node, T arg) => 440 R visitVariableDeclaration(VariableDeclaration node, T arg) =>
437 defaultStatement(node, arg); 441 defaultStatement(node, arg);
438 R visitFunctionDeclaration(FunctionDeclaration node, T arg) => 442 R visitFunctionDeclaration(FunctionDeclaration node, T arg) =>
439 defaultStatement(node, arg); 443 defaultStatement(node, arg);
440 } 444 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/verifier.dart ('k') | pkg/kernel/test/type_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698