OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
6 * Defines AST visitors that support useful patterns for visiting the nodes in | 6 * Defines AST visitors that support useful patterns for visiting the nodes in |
7 * an [AST structure](ast.dart). | 7 * an [AST structure](ast.dart). |
8 * | 8 * |
9 * Dart is an evolving language, and the AST structure must evolved with it. | 9 * Dart is an evolving language, and the AST structure must evolved with it. |
10 * When the AST structure changes, the visitor interface will sometimes change | 10 * When the AST structure changes, the visitor interface will sometimes change |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 @override | 87 @override |
88 R visitNode(AstNode node) { | 88 R visitNode(AstNode node) { |
89 node.visitChildren(_childVisitor); | 89 node.visitChildren(_childVisitor); |
90 return null; | 90 return null; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 /** | 94 /** |
95 * An AST visitor that will recursively visit all of the nodes in an AST | 95 * An AST visitor that will recursively visit all of the nodes in an AST |
| 96 * structure. For each node that is visited, the corresponding visit method on |
| 97 * one or more other visitors (the 'delegates') will be invoked. |
| 98 * |
| 99 * For example, if an instance of this class is created with two delegates V1 |
| 100 * and V2, and that instance is used to visit the expression 'x + 1', then the |
| 101 * following visit methods will be invoked: |
| 102 * 1. V1.visitBinaryExpression |
| 103 * 2. V2.visitBinaryExpression |
| 104 * 3. V1.visitSimpleIdentifier |
| 105 * 4. V2.visitSimpleIdentifier |
| 106 * 5. V1.visitIntegerLiteral |
| 107 * 6. V2.visitIntegerLiteral |
| 108 * |
| 109 * Clients may not extend, implement or mix-in this class. |
| 110 */ |
| 111 class DelegatingAstVisitor<T> implements AstVisitor<T> { |
| 112 /** |
| 113 * The delegates whose visit methods will be invoked. |
| 114 */ |
| 115 final Iterable<AstVisitor<T>> _delegates; |
| 116 |
| 117 /** |
| 118 * Initialize a newly created visitor to use each of the given delegate |
| 119 * visitors to visit the nodes of an AST structure. |
| 120 */ |
| 121 DelegatingAstVisitor(this._delegates); |
| 122 |
| 123 @override |
| 124 T visitAdjacentStrings(AdjacentStrings node) { |
| 125 _delegates.forEach((delegate) => delegate.visitAdjacentStrings(node)); |
| 126 node.visitChildren(this); |
| 127 return null; |
| 128 } |
| 129 |
| 130 @override |
| 131 T visitAnnotation(Annotation node) { |
| 132 _delegates.forEach((delegate) => delegate.visitAnnotation(node)); |
| 133 node.visitChildren(this); |
| 134 return null; |
| 135 } |
| 136 |
| 137 @override |
| 138 T visitArgumentList(ArgumentList node) { |
| 139 _delegates.forEach((delegate) => delegate.visitArgumentList(node)); |
| 140 node.visitChildren(this); |
| 141 return null; |
| 142 } |
| 143 |
| 144 @override |
| 145 T visitAsExpression(AsExpression node) { |
| 146 _delegates.forEach((delegate) => delegate.visitAsExpression(node)); |
| 147 node.visitChildren(this); |
| 148 return null; |
| 149 } |
| 150 |
| 151 @override |
| 152 T visitAssertStatement(AssertStatement node) { |
| 153 _delegates.forEach((delegate) => delegate.visitAssertStatement(node)); |
| 154 node.visitChildren(this); |
| 155 return null; |
| 156 } |
| 157 |
| 158 @override |
| 159 T visitAssignmentExpression(AssignmentExpression node) { |
| 160 _delegates.forEach((delegate) => delegate.visitAssignmentExpression(node)); |
| 161 node.visitChildren(this); |
| 162 return null; |
| 163 } |
| 164 |
| 165 @override |
| 166 T visitAwaitExpression(AwaitExpression node) { |
| 167 _delegates.forEach((delegate) => delegate.visitAwaitExpression(node)); |
| 168 node.visitChildren(this); |
| 169 return null; |
| 170 } |
| 171 |
| 172 @override |
| 173 T visitBinaryExpression(BinaryExpression node) { |
| 174 _delegates.forEach((delegate) => delegate.visitBinaryExpression(node)); |
| 175 node.visitChildren(this); |
| 176 return null; |
| 177 } |
| 178 |
| 179 @override |
| 180 T visitBlock(Block node) { |
| 181 _delegates.forEach((delegate) => delegate.visitBlock(node)); |
| 182 node.visitChildren(this); |
| 183 return null; |
| 184 } |
| 185 |
| 186 @override |
| 187 T visitBlockFunctionBody(BlockFunctionBody node) { |
| 188 _delegates.forEach((delegate) => delegate.visitBlockFunctionBody(node)); |
| 189 node.visitChildren(this); |
| 190 return null; |
| 191 } |
| 192 |
| 193 @override |
| 194 T visitBooleanLiteral(BooleanLiteral node) { |
| 195 _delegates.forEach((delegate) => delegate.visitBooleanLiteral(node)); |
| 196 node.visitChildren(this); |
| 197 return null; |
| 198 } |
| 199 |
| 200 @override |
| 201 T visitBreakStatement(BreakStatement node) { |
| 202 _delegates.forEach((delegate) => delegate.visitBreakStatement(node)); |
| 203 node.visitChildren(this); |
| 204 return null; |
| 205 } |
| 206 |
| 207 @override |
| 208 T visitCascadeExpression(CascadeExpression node) { |
| 209 _delegates.forEach((delegate) => delegate.visitCascadeExpression(node)); |
| 210 node.visitChildren(this); |
| 211 return null; |
| 212 } |
| 213 |
| 214 @override |
| 215 T visitCatchClause(CatchClause node) { |
| 216 _delegates.forEach((delegate) => delegate.visitCatchClause(node)); |
| 217 node.visitChildren(this); |
| 218 return null; |
| 219 } |
| 220 |
| 221 @override |
| 222 T visitClassDeclaration(ClassDeclaration node) { |
| 223 _delegates.forEach((delegate) => delegate.visitClassDeclaration(node)); |
| 224 node.visitChildren(this); |
| 225 return null; |
| 226 } |
| 227 |
| 228 @override |
| 229 T visitClassTypeAlias(ClassTypeAlias node) { |
| 230 _delegates.forEach((delegate) => delegate.visitClassTypeAlias(node)); |
| 231 node.visitChildren(this); |
| 232 return null; |
| 233 } |
| 234 |
| 235 @override |
| 236 T visitComment(Comment node) { |
| 237 _delegates.forEach((delegate) => delegate.visitComment(node)); |
| 238 node.visitChildren(this); |
| 239 return null; |
| 240 } |
| 241 |
| 242 @override |
| 243 T visitCommentReference(CommentReference node) { |
| 244 _delegates.forEach((delegate) => delegate.visitCommentReference(node)); |
| 245 node.visitChildren(this); |
| 246 return null; |
| 247 } |
| 248 |
| 249 @override |
| 250 T visitCompilationUnit(CompilationUnit node) { |
| 251 _delegates.forEach((delegate) => delegate.visitCompilationUnit(node)); |
| 252 node.visitChildren(this); |
| 253 return null; |
| 254 } |
| 255 |
| 256 @override |
| 257 T visitConditionalExpression(ConditionalExpression node) { |
| 258 _delegates.forEach((delegate) => delegate.visitConditionalExpression(node)); |
| 259 node.visitChildren(this); |
| 260 return null; |
| 261 } |
| 262 |
| 263 @override |
| 264 T visitConfiguration(Configuration node) { |
| 265 _delegates.forEach((delegate) => delegate.visitConfiguration(node)); |
| 266 node.visitChildren(this); |
| 267 return null; |
| 268 } |
| 269 |
| 270 @override |
| 271 T visitConstructorDeclaration(ConstructorDeclaration node) { |
| 272 _delegates |
| 273 .forEach((delegate) => delegate.visitConstructorDeclaration(node)); |
| 274 node.visitChildren(this); |
| 275 return null; |
| 276 } |
| 277 |
| 278 @override |
| 279 T visitConstructorFieldInitializer(ConstructorFieldInitializer node) { |
| 280 _delegates |
| 281 .forEach((delegate) => delegate.visitConstructorFieldInitializer(node)); |
| 282 node.visitChildren(this); |
| 283 return null; |
| 284 } |
| 285 |
| 286 @override |
| 287 T visitConstructorName(ConstructorName node) { |
| 288 _delegates.forEach((delegate) => delegate.visitConstructorName(node)); |
| 289 node.visitChildren(this); |
| 290 return null; |
| 291 } |
| 292 |
| 293 @override |
| 294 T visitContinueStatement(ContinueStatement node) { |
| 295 _delegates.forEach((delegate) => delegate.visitContinueStatement(node)); |
| 296 node.visitChildren(this); |
| 297 return null; |
| 298 } |
| 299 |
| 300 @override |
| 301 T visitDeclaredIdentifier(DeclaredIdentifier node) { |
| 302 _delegates.forEach((delegate) => delegate.visitDeclaredIdentifier(node)); |
| 303 node.visitChildren(this); |
| 304 return null; |
| 305 } |
| 306 |
| 307 @override |
| 308 T visitDefaultFormalParameter(DefaultFormalParameter node) { |
| 309 _delegates |
| 310 .forEach((delegate) => delegate.visitDefaultFormalParameter(node)); |
| 311 node.visitChildren(this); |
| 312 return null; |
| 313 } |
| 314 |
| 315 @override |
| 316 T visitDoStatement(DoStatement node) { |
| 317 _delegates.forEach((delegate) => delegate.visitDoStatement(node)); |
| 318 node.visitChildren(this); |
| 319 return null; |
| 320 } |
| 321 |
| 322 @override |
| 323 T visitDottedName(DottedName node) { |
| 324 _delegates.forEach((delegate) => delegate.visitDottedName(node)); |
| 325 node.visitChildren(this); |
| 326 return null; |
| 327 } |
| 328 |
| 329 @override |
| 330 T visitDoubleLiteral(DoubleLiteral node) { |
| 331 _delegates.forEach((delegate) => delegate.visitDoubleLiteral(node)); |
| 332 node.visitChildren(this); |
| 333 return null; |
| 334 } |
| 335 |
| 336 @override |
| 337 T visitEmptyFunctionBody(EmptyFunctionBody node) { |
| 338 _delegates.forEach((delegate) => delegate.visitEmptyFunctionBody(node)); |
| 339 node.visitChildren(this); |
| 340 return null; |
| 341 } |
| 342 |
| 343 @override |
| 344 T visitEmptyStatement(EmptyStatement node) { |
| 345 _delegates.forEach((delegate) => delegate.visitEmptyStatement(node)); |
| 346 node.visitChildren(this); |
| 347 return null; |
| 348 } |
| 349 |
| 350 @override |
| 351 T visitEnumConstantDeclaration(EnumConstantDeclaration node) { |
| 352 _delegates |
| 353 .forEach((delegate) => delegate.visitEnumConstantDeclaration(node)); |
| 354 node.visitChildren(this); |
| 355 return null; |
| 356 } |
| 357 |
| 358 @override |
| 359 T visitEnumDeclaration(EnumDeclaration node) { |
| 360 _delegates.forEach((delegate) => delegate.visitEnumDeclaration(node)); |
| 361 node.visitChildren(this); |
| 362 return null; |
| 363 } |
| 364 |
| 365 @override |
| 366 T visitExportDirective(ExportDirective node) { |
| 367 _delegates.forEach((delegate) => delegate.visitExportDirective(node)); |
| 368 node.visitChildren(this); |
| 369 return null; |
| 370 } |
| 371 |
| 372 @override |
| 373 T visitExpressionFunctionBody(ExpressionFunctionBody node) { |
| 374 _delegates |
| 375 .forEach((delegate) => delegate.visitExpressionFunctionBody(node)); |
| 376 node.visitChildren(this); |
| 377 return null; |
| 378 } |
| 379 |
| 380 @override |
| 381 T visitExpressionStatement(ExpressionStatement node) { |
| 382 _delegates.forEach((delegate) => delegate.visitExpressionStatement(node)); |
| 383 node.visitChildren(this); |
| 384 return null; |
| 385 } |
| 386 |
| 387 @override |
| 388 T visitExtendsClause(ExtendsClause node) { |
| 389 _delegates.forEach((delegate) => delegate.visitExtendsClause(node)); |
| 390 node.visitChildren(this); |
| 391 return null; |
| 392 } |
| 393 |
| 394 @override |
| 395 T visitFieldDeclaration(FieldDeclaration node) { |
| 396 _delegates.forEach((delegate) => delegate.visitFieldDeclaration(node)); |
| 397 node.visitChildren(this); |
| 398 return null; |
| 399 } |
| 400 |
| 401 @override |
| 402 T visitFieldFormalParameter(FieldFormalParameter node) { |
| 403 _delegates.forEach((delegate) => delegate.visitFieldFormalParameter(node)); |
| 404 node.visitChildren(this); |
| 405 return null; |
| 406 } |
| 407 |
| 408 @override |
| 409 T visitForEachStatement(ForEachStatement node) { |
| 410 _delegates.forEach((delegate) => delegate.visitForEachStatement(node)); |
| 411 node.visitChildren(this); |
| 412 return null; |
| 413 } |
| 414 |
| 415 @override |
| 416 T visitFormalParameterList(FormalParameterList node) { |
| 417 _delegates.forEach((delegate) => delegate.visitFormalParameterList(node)); |
| 418 node.visitChildren(this); |
| 419 return null; |
| 420 } |
| 421 |
| 422 @override |
| 423 T visitForStatement(ForStatement node) { |
| 424 _delegates.forEach((delegate) => delegate.visitForStatement(node)); |
| 425 node.visitChildren(this); |
| 426 return null; |
| 427 } |
| 428 |
| 429 @override |
| 430 T visitFunctionDeclaration(FunctionDeclaration node) { |
| 431 _delegates.forEach((delegate) => delegate.visitFunctionDeclaration(node)); |
| 432 node.visitChildren(this); |
| 433 return null; |
| 434 } |
| 435 |
| 436 @override |
| 437 T visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { |
| 438 _delegates.forEach( |
| 439 (delegate) => delegate.visitFunctionDeclarationStatement(node)); |
| 440 node.visitChildren(this); |
| 441 return null; |
| 442 } |
| 443 |
| 444 @override |
| 445 T visitFunctionExpression(FunctionExpression node) { |
| 446 _delegates.forEach((delegate) => delegate.visitFunctionExpression(node)); |
| 447 node.visitChildren(this); |
| 448 return null; |
| 449 } |
| 450 |
| 451 @override |
| 452 T visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 453 _delegates.forEach( |
| 454 (delegate) => delegate.visitFunctionExpressionInvocation(node)); |
| 455 node.visitChildren(this); |
| 456 return null; |
| 457 } |
| 458 |
| 459 @override |
| 460 T visitFunctionTypeAlias(FunctionTypeAlias node) { |
| 461 _delegates.forEach((delegate) => delegate.visitFunctionTypeAlias(node)); |
| 462 node.visitChildren(this); |
| 463 return null; |
| 464 } |
| 465 |
| 466 @override |
| 467 T visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { |
| 468 _delegates.forEach( |
| 469 (delegate) => delegate.visitFunctionTypedFormalParameter(node)); |
| 470 node.visitChildren(this); |
| 471 return null; |
| 472 } |
| 473 |
| 474 @override |
| 475 T visitHideCombinator(HideCombinator node) { |
| 476 _delegates.forEach((delegate) => delegate.visitHideCombinator(node)); |
| 477 node.visitChildren(this); |
| 478 return null; |
| 479 } |
| 480 |
| 481 @override |
| 482 T visitIfStatement(IfStatement node) { |
| 483 _delegates.forEach((delegate) => delegate.visitIfStatement(node)); |
| 484 node.visitChildren(this); |
| 485 return null; |
| 486 } |
| 487 |
| 488 @override |
| 489 T visitImplementsClause(ImplementsClause node) { |
| 490 _delegates.forEach((delegate) => delegate.visitImplementsClause(node)); |
| 491 node.visitChildren(this); |
| 492 return null; |
| 493 } |
| 494 |
| 495 @override |
| 496 T visitImportDirective(ImportDirective node) { |
| 497 _delegates.forEach((delegate) => delegate.visitImportDirective(node)); |
| 498 node.visitChildren(this); |
| 499 return null; |
| 500 } |
| 501 |
| 502 @override |
| 503 T visitIndexExpression(IndexExpression node) { |
| 504 _delegates.forEach((delegate) => delegate.visitIndexExpression(node)); |
| 505 node.visitChildren(this); |
| 506 return null; |
| 507 } |
| 508 |
| 509 @override |
| 510 T visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 511 _delegates |
| 512 .forEach((delegate) => delegate.visitInstanceCreationExpression(node)); |
| 513 node.visitChildren(this); |
| 514 return null; |
| 515 } |
| 516 |
| 517 @override |
| 518 T visitIntegerLiteral(IntegerLiteral node) { |
| 519 _delegates.forEach((delegate) => delegate.visitIntegerLiteral(node)); |
| 520 node.visitChildren(this); |
| 521 return null; |
| 522 } |
| 523 |
| 524 @override |
| 525 T visitInterpolationExpression(InterpolationExpression node) { |
| 526 _delegates |
| 527 .forEach((delegate) => delegate.visitInterpolationExpression(node)); |
| 528 node.visitChildren(this); |
| 529 return null; |
| 530 } |
| 531 |
| 532 @override |
| 533 T visitInterpolationString(InterpolationString node) { |
| 534 _delegates.forEach((delegate) => delegate.visitInterpolationString(node)); |
| 535 node.visitChildren(this); |
| 536 return null; |
| 537 } |
| 538 |
| 539 @override |
| 540 T visitIsExpression(IsExpression node) { |
| 541 _delegates.forEach((delegate) => delegate.visitIsExpression(node)); |
| 542 node.visitChildren(this); |
| 543 return null; |
| 544 } |
| 545 |
| 546 @override |
| 547 T visitLabel(Label node) { |
| 548 _delegates.forEach((delegate) => delegate.visitLabel(node)); |
| 549 node.visitChildren(this); |
| 550 return null; |
| 551 } |
| 552 |
| 553 @override |
| 554 T visitLabeledStatement(LabeledStatement node) { |
| 555 _delegates.forEach((delegate) => delegate.visitLabeledStatement(node)); |
| 556 node.visitChildren(this); |
| 557 return null; |
| 558 } |
| 559 |
| 560 @override |
| 561 T visitLibraryDirective(LibraryDirective node) { |
| 562 _delegates.forEach((delegate) => delegate.visitLibraryDirective(node)); |
| 563 node.visitChildren(this); |
| 564 return null; |
| 565 } |
| 566 |
| 567 @override |
| 568 T visitLibraryIdentifier(LibraryIdentifier node) { |
| 569 _delegates.forEach((delegate) => delegate.visitLibraryIdentifier(node)); |
| 570 node.visitChildren(this); |
| 571 return null; |
| 572 } |
| 573 |
| 574 @override |
| 575 T visitListLiteral(ListLiteral node) { |
| 576 _delegates.forEach((delegate) => delegate.visitListLiteral(node)); |
| 577 node.visitChildren(this); |
| 578 return null; |
| 579 } |
| 580 |
| 581 @override |
| 582 T visitMapLiteral(MapLiteral node) { |
| 583 _delegates.forEach((delegate) => delegate.visitMapLiteral(node)); |
| 584 node.visitChildren(this); |
| 585 return null; |
| 586 } |
| 587 |
| 588 @override |
| 589 T visitMapLiteralEntry(MapLiteralEntry node) { |
| 590 _delegates.forEach((delegate) => delegate.visitMapLiteralEntry(node)); |
| 591 node.visitChildren(this); |
| 592 return null; |
| 593 } |
| 594 |
| 595 @override |
| 596 T visitMethodDeclaration(MethodDeclaration node) { |
| 597 _delegates.forEach((delegate) => delegate.visitMethodDeclaration(node)); |
| 598 node.visitChildren(this); |
| 599 return null; |
| 600 } |
| 601 |
| 602 @override |
| 603 T visitMethodInvocation(MethodInvocation node) { |
| 604 _delegates.forEach((delegate) => delegate.visitMethodInvocation(node)); |
| 605 node.visitChildren(this); |
| 606 return null; |
| 607 } |
| 608 |
| 609 @override |
| 610 T visitNamedExpression(NamedExpression node) { |
| 611 _delegates.forEach((delegate) => delegate.visitNamedExpression(node)); |
| 612 node.visitChildren(this); |
| 613 return null; |
| 614 } |
| 615 |
| 616 @override |
| 617 T visitNativeClause(NativeClause node) { |
| 618 _delegates.forEach((delegate) => delegate.visitNativeClause(node)); |
| 619 node.visitChildren(this); |
| 620 return null; |
| 621 } |
| 622 |
| 623 @override |
| 624 T visitNativeFunctionBody(NativeFunctionBody node) { |
| 625 _delegates.forEach((delegate) => delegate.visitNativeFunctionBody(node)); |
| 626 node.visitChildren(this); |
| 627 return null; |
| 628 } |
| 629 |
| 630 @override |
| 631 T visitNullLiteral(NullLiteral node) { |
| 632 _delegates.forEach((delegate) => delegate.visitNullLiteral(node)); |
| 633 node.visitChildren(this); |
| 634 return null; |
| 635 } |
| 636 |
| 637 @override |
| 638 T visitParenthesizedExpression(ParenthesizedExpression node) { |
| 639 _delegates |
| 640 .forEach((delegate) => delegate.visitParenthesizedExpression(node)); |
| 641 node.visitChildren(this); |
| 642 return null; |
| 643 } |
| 644 |
| 645 @override |
| 646 T visitPartDirective(PartDirective node) { |
| 647 _delegates.forEach((delegate) => delegate.visitPartDirective(node)); |
| 648 node.visitChildren(this); |
| 649 return null; |
| 650 } |
| 651 |
| 652 @override |
| 653 T visitPartOfDirective(PartOfDirective node) { |
| 654 _delegates.forEach((delegate) => delegate.visitPartOfDirective(node)); |
| 655 node.visitChildren(this); |
| 656 return null; |
| 657 } |
| 658 |
| 659 @override |
| 660 T visitPostfixExpression(PostfixExpression node) { |
| 661 _delegates.forEach((delegate) => delegate.visitPostfixExpression(node)); |
| 662 node.visitChildren(this); |
| 663 return null; |
| 664 } |
| 665 |
| 666 @override |
| 667 T visitPrefixedIdentifier(PrefixedIdentifier node) { |
| 668 _delegates.forEach((delegate) => delegate.visitPrefixedIdentifier(node)); |
| 669 node.visitChildren(this); |
| 670 return null; |
| 671 } |
| 672 |
| 673 @override |
| 674 T visitPrefixExpression(PrefixExpression node) { |
| 675 _delegates.forEach((delegate) => delegate.visitPrefixExpression(node)); |
| 676 node.visitChildren(this); |
| 677 return null; |
| 678 } |
| 679 |
| 680 @override |
| 681 T visitPropertyAccess(PropertyAccess node) { |
| 682 _delegates.forEach((delegate) => delegate.visitPropertyAccess(node)); |
| 683 node.visitChildren(this); |
| 684 return null; |
| 685 } |
| 686 |
| 687 @override |
| 688 T visitRedirectingConstructorInvocation( |
| 689 RedirectingConstructorInvocation node) { |
| 690 _delegates.forEach( |
| 691 (delegate) => delegate.visitRedirectingConstructorInvocation(node)); |
| 692 node.visitChildren(this); |
| 693 return null; |
| 694 } |
| 695 |
| 696 @override |
| 697 T visitRethrowExpression(RethrowExpression node) { |
| 698 _delegates.forEach((delegate) => delegate.visitRethrowExpression(node)); |
| 699 node.visitChildren(this); |
| 700 return null; |
| 701 } |
| 702 |
| 703 @override |
| 704 T visitReturnStatement(ReturnStatement node) { |
| 705 _delegates.forEach((delegate) => delegate.visitReturnStatement(node)); |
| 706 node.visitChildren(this); |
| 707 return null; |
| 708 } |
| 709 |
| 710 @override |
| 711 T visitScriptTag(ScriptTag node) { |
| 712 _delegates.forEach((delegate) => delegate.visitScriptTag(node)); |
| 713 node.visitChildren(this); |
| 714 return null; |
| 715 } |
| 716 |
| 717 @override |
| 718 T visitShowCombinator(ShowCombinator node) { |
| 719 _delegates.forEach((delegate) => delegate.visitShowCombinator(node)); |
| 720 node.visitChildren(this); |
| 721 return null; |
| 722 } |
| 723 |
| 724 @override |
| 725 T visitSimpleFormalParameter(SimpleFormalParameter node) { |
| 726 _delegates.forEach((delegate) => delegate.visitSimpleFormalParameter(node)); |
| 727 node.visitChildren(this); |
| 728 return null; |
| 729 } |
| 730 |
| 731 @override |
| 732 T visitSimpleIdentifier(SimpleIdentifier node) { |
| 733 _delegates.forEach((delegate) => delegate.visitSimpleIdentifier(node)); |
| 734 node.visitChildren(this); |
| 735 return null; |
| 736 } |
| 737 |
| 738 @override |
| 739 T visitSimpleStringLiteral(SimpleStringLiteral node) { |
| 740 _delegates.forEach((delegate) => delegate.visitSimpleStringLiteral(node)); |
| 741 node.visitChildren(this); |
| 742 return null; |
| 743 } |
| 744 |
| 745 @override |
| 746 T visitStringInterpolation(StringInterpolation node) { |
| 747 _delegates.forEach((delegate) => delegate.visitStringInterpolation(node)); |
| 748 node.visitChildren(this); |
| 749 return null; |
| 750 } |
| 751 |
| 752 @override |
| 753 T visitSuperConstructorInvocation(SuperConstructorInvocation node) { |
| 754 _delegates |
| 755 .forEach((delegate) => delegate.visitSuperConstructorInvocation(node)); |
| 756 node.visitChildren(this); |
| 757 return null; |
| 758 } |
| 759 |
| 760 @override |
| 761 T visitSuperExpression(SuperExpression node) { |
| 762 _delegates.forEach((delegate) => delegate.visitSuperExpression(node)); |
| 763 node.visitChildren(this); |
| 764 return null; |
| 765 } |
| 766 |
| 767 @override |
| 768 T visitSwitchCase(SwitchCase node) { |
| 769 _delegates.forEach((delegate) => delegate.visitSwitchCase(node)); |
| 770 node.visitChildren(this); |
| 771 return null; |
| 772 } |
| 773 |
| 774 @override |
| 775 T visitSwitchDefault(SwitchDefault node) { |
| 776 _delegates.forEach((delegate) => delegate.visitSwitchDefault(node)); |
| 777 node.visitChildren(this); |
| 778 return null; |
| 779 } |
| 780 |
| 781 @override |
| 782 T visitSwitchStatement(SwitchStatement node) { |
| 783 _delegates.forEach((delegate) => delegate.visitSwitchStatement(node)); |
| 784 node.visitChildren(this); |
| 785 return null; |
| 786 } |
| 787 |
| 788 @override |
| 789 T visitSymbolLiteral(SymbolLiteral node) { |
| 790 _delegates.forEach((delegate) => delegate.visitSymbolLiteral(node)); |
| 791 node.visitChildren(this); |
| 792 return null; |
| 793 } |
| 794 |
| 795 @override |
| 796 T visitThisExpression(ThisExpression node) { |
| 797 _delegates.forEach((delegate) => delegate.visitThisExpression(node)); |
| 798 node.visitChildren(this); |
| 799 return null; |
| 800 } |
| 801 |
| 802 @override |
| 803 T visitThrowExpression(ThrowExpression node) { |
| 804 _delegates.forEach((delegate) => delegate.visitThrowExpression(node)); |
| 805 node.visitChildren(this); |
| 806 return null; |
| 807 } |
| 808 |
| 809 @override |
| 810 T visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { |
| 811 _delegates |
| 812 .forEach((delegate) => delegate.visitTopLevelVariableDeclaration(node)); |
| 813 node.visitChildren(this); |
| 814 return null; |
| 815 } |
| 816 |
| 817 @override |
| 818 T visitTryStatement(TryStatement node) { |
| 819 _delegates.forEach((delegate) => delegate.visitTryStatement(node)); |
| 820 node.visitChildren(this); |
| 821 return null; |
| 822 } |
| 823 |
| 824 @override |
| 825 T visitTypeArgumentList(TypeArgumentList node) { |
| 826 _delegates.forEach((delegate) => delegate.visitTypeArgumentList(node)); |
| 827 node.visitChildren(this); |
| 828 return null; |
| 829 } |
| 830 |
| 831 @override |
| 832 T visitTypeName(TypeName node) { |
| 833 _delegates.forEach((delegate) => delegate.visitTypeName(node)); |
| 834 node.visitChildren(this); |
| 835 return null; |
| 836 } |
| 837 |
| 838 @override |
| 839 T visitTypeParameter(TypeParameter node) { |
| 840 _delegates.forEach((delegate) => delegate.visitTypeParameter(node)); |
| 841 node.visitChildren(this); |
| 842 return null; |
| 843 } |
| 844 |
| 845 @override |
| 846 T visitTypeParameterList(TypeParameterList node) { |
| 847 _delegates.forEach((delegate) => delegate.visitTypeParameterList(node)); |
| 848 node.visitChildren(this); |
| 849 return null; |
| 850 } |
| 851 |
| 852 @override |
| 853 T visitVariableDeclaration(VariableDeclaration node) { |
| 854 _delegates.forEach((delegate) => delegate.visitVariableDeclaration(node)); |
| 855 node.visitChildren(this); |
| 856 return null; |
| 857 } |
| 858 |
| 859 @override |
| 860 T visitVariableDeclarationList(VariableDeclarationList node) { |
| 861 _delegates |
| 862 .forEach((delegate) => delegate.visitVariableDeclarationList(node)); |
| 863 node.visitChildren(this); |
| 864 return null; |
| 865 } |
| 866 |
| 867 @override |
| 868 T visitVariableDeclarationStatement(VariableDeclarationStatement node) { |
| 869 _delegates.forEach( |
| 870 (delegate) => delegate.visitVariableDeclarationStatement(node)); |
| 871 node.visitChildren(this); |
| 872 return null; |
| 873 } |
| 874 |
| 875 @override |
| 876 T visitWhileStatement(WhileStatement node) { |
| 877 _delegates.forEach((delegate) => delegate.visitWhileStatement(node)); |
| 878 node.visitChildren(this); |
| 879 return null; |
| 880 } |
| 881 |
| 882 @override |
| 883 T visitWithClause(WithClause node) { |
| 884 _delegates.forEach((delegate) => delegate.visitWithClause(node)); |
| 885 node.visitChildren(this); |
| 886 return null; |
| 887 } |
| 888 |
| 889 @override |
| 890 T visitYieldStatement(YieldStatement node) { |
| 891 _delegates.forEach((delegate) => delegate.visitYieldStatement(node)); |
| 892 node.visitChildren(this); |
| 893 return null; |
| 894 } |
| 895 } |
| 896 |
| 897 /** |
| 898 * An AST visitor that will recursively visit all of the nodes in an AST |
96 * structure (like instances of the class [RecursiveAstVisitor]). In addition, | 899 * structure (like instances of the class [RecursiveAstVisitor]). In addition, |
97 * when a node of a specific type is visited not only will the visit method for | 900 * when a node of a specific type is visited not only will the visit method for |
98 * that specific type of node be invoked, but additional methods for the | 901 * that specific type of node be invoked, but additional methods for the |
99 * superclasses of that node will also be invoked. For example, using an | 902 * superclasses of that node will also be invoked. For example, using an |
100 * instance of this class to visit a [Block] will cause the method [visitBlock] | 903 * instance of this class to visit a [Block] will cause the method [visitBlock] |
101 * to be invoked but will also cause the methods [visitStatement] and | 904 * to be invoked but will also cause the methods [visitStatement] and |
102 * [visitNode] to be subsequently invoked. This allows visitors to be written | 905 * [visitNode] to be subsequently invoked. This allows visitors to be written |
103 * that visit all statements without needing to override the visit method for | 906 * that visit all statements without needing to override the visit method for |
104 * each of the specific subclasses of [Statement]. | 907 * each of the specific subclasses of [Statement]. |
105 * | 908 * |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 * Initialize a newly created visitor to help the [outerVisitor]. | 2697 * Initialize a newly created visitor to help the [outerVisitor]. |
1895 */ | 2698 */ |
1896 _BreadthFirstChildVisitor(this.outerVisitor); | 2699 _BreadthFirstChildVisitor(this.outerVisitor); |
1897 | 2700 |
1898 @override | 2701 @override |
1899 Object visitNode(AstNode node) { | 2702 Object visitNode(AstNode node) { |
1900 outerVisitor._queue.add(node); | 2703 outerVisitor._queue.add(node); |
1901 return null; | 2704 return null; |
1902 } | 2705 } |
1903 } | 2706 } |
OLD | NEW |