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 | 4 |
5 /// Functions for asserting equivalence across serialization. | 5 /// Functions for asserting equivalence across serialization. |
6 | 6 |
7 library dart2js.serialization.equivalence; | 7 library dart2js.serialization.equivalence; |
8 | 8 |
9 import '../closure.dart'; | 9 import '../closure.dart'; |
10 import '../common/resolution.dart'; | 10 import '../common/resolution.dart'; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 /// Returns `true` if elements [a] and [b] are equivalent. | 98 /// Returns `true` if elements [a] and [b] are equivalent. |
99 bool areElementsEquivalent(Element a, Element b, {TestStrategy strategy}) { | 99 bool areElementsEquivalent(Element a, Element b, {TestStrategy strategy}) { |
100 if (identical(a, b)) return true; | 100 if (identical(a, b)) return true; |
101 if (a == null || b == null) return false; | 101 if (a == null || b == null) return false; |
102 return new ElementIdentityEquivalence(strategy ?? const TestStrategy()) | 102 return new ElementIdentityEquivalence(strategy ?? const TestStrategy()) |
103 .visit(a, b); | 103 .visit(a, b); |
104 } | 104 } |
105 | 105 |
| 106 bool areEntitiesEquivalent(Entity a, Entity b, {TestStrategy strategy}) { |
| 107 return areElementsEquivalent(a, b, strategy: strategy); |
| 108 } |
| 109 |
106 /// Returns `true` if types [a] and [b] are equivalent. | 110 /// Returns `true` if types [a] and [b] are equivalent. |
107 bool areTypesEquivalent(DartType a, DartType b, {TestStrategy strategy}) { | 111 bool areTypesEquivalent(DartType a, DartType b, {TestStrategy strategy}) { |
108 if (identical(a, b)) return true; | 112 if (identical(a, b)) return true; |
109 if (a == null || b == null) return false; | 113 if (a == null || b == null) return false; |
110 return new TypeEquivalence(strategy ?? const TestStrategy()).visit(a, b); | 114 return new TypeEquivalence(strategy ?? const TestStrategy()).visit(a, b); |
111 } | 115 } |
112 | 116 |
113 /// Returns `true` if constants [exp1] and [exp2] are equivalent. | 117 /// Returns `true` if constants [exp1] and [exp2] are equivalent. |
114 bool areConstantsEquivalent(ConstantExpression exp1, ConstantExpression exp2, | 118 bool areConstantsEquivalent(ConstantExpression exp1, ConstantExpression exp2, |
115 {TestStrategy strategy}) { | 119 {TestStrategy strategy}) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 /// Strategy for testing equivalence. | 353 /// Strategy for testing equivalence. |
350 /// | 354 /// |
351 /// Use this strategy to determine equivalence without failing on inequivalence. | 355 /// Use this strategy to determine equivalence without failing on inequivalence. |
352 class TestStrategy { | 356 class TestStrategy { |
353 final Equivalence<Entity> elementEquivalence; | 357 final Equivalence<Entity> elementEquivalence; |
354 final Equivalence<DartType> typeEquivalence; | 358 final Equivalence<DartType> typeEquivalence; |
355 final Equivalence<ConstantExpression> constantEquivalence; | 359 final Equivalence<ConstantExpression> constantEquivalence; |
356 final Equivalence<ConstantValue> constantValueEquivalence; | 360 final Equivalence<ConstantValue> constantValueEquivalence; |
357 | 361 |
358 const TestStrategy( | 362 const TestStrategy( |
359 {this.elementEquivalence: areElementsEquivalent, | 363 {this.elementEquivalence: areEntitiesEquivalent, |
360 this.typeEquivalence: areTypesEquivalent, | 364 this.typeEquivalence: areTypesEquivalent, |
361 this.constantEquivalence: areConstantsEquivalent, | 365 this.constantEquivalence: areConstantsEquivalent, |
362 this.constantValueEquivalence: areConstantValuesEquivalent}); | 366 this.constantValueEquivalence: areConstantValuesEquivalent}); |
363 | 367 |
364 /// An equivalence [TestStrategy] that doesn't throw on inequivalence. | 368 /// An equivalence [TestStrategy] that doesn't throw on inequivalence. |
365 TestStrategy get testOnly => this; | 369 TestStrategy get testOnly => this; |
366 | 370 |
367 bool test(dynamic object1, dynamic object2, String property, dynamic value1, | 371 bool test(dynamic object1, dynamic object2, String property, dynamic value1, |
368 dynamic value2, | 372 dynamic value2, |
369 [bool equivalence(a, b) = equality]) { | 373 [bool equivalence(a, b) = equality]) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 element1, element2, 'kind', element1.kind, element2.kind) && | 462 element1, element2, 'kind', element1.kind, element2.kind) && |
459 element1.accept(this, element2); | 463 element1.accept(this, element2); |
460 } | 464 } |
461 | 465 |
462 @override | 466 @override |
463 bool visitElement(Element e, Element arg) { | 467 bool visitElement(Element e, Element arg) { |
464 throw new UnsupportedError("Unsupported element $e"); | 468 throw new UnsupportedError("Unsupported element $e"); |
465 } | 469 } |
466 | 470 |
467 @override | 471 @override |
468 bool visitLibraryElement(LibraryElement element1, LibraryElement element2) { | 472 bool visitLibraryElement( |
| 473 LibraryElement element1, covariant LibraryElement element2) { |
469 return strategy.test(element1, element2, 'canonicalUri', | 474 return strategy.test(element1, element2, 'canonicalUri', |
470 element1.canonicalUri, element2.canonicalUri); | 475 element1.canonicalUri, element2.canonicalUri); |
471 } | 476 } |
472 | 477 |
473 @override | 478 @override |
474 bool visitCompilationUnitElement( | 479 bool visitCompilationUnitElement(CompilationUnitElement element1, |
475 CompilationUnitElement element1, CompilationUnitElement element2) { | 480 covariant CompilationUnitElement element2) { |
476 return strategy.test(element1, element2, 'script.resourceUri', | 481 return strategy.test(element1, element2, 'script.resourceUri', |
477 element1.script.resourceUri, element2.script.resourceUri) && | 482 element1.script.resourceUri, element2.script.resourceUri) && |
478 visit(element1.library, element2.library); | 483 visit(element1.library, element2.library); |
479 } | 484 } |
480 | 485 |
481 @override | 486 @override |
482 bool visitClassElement(ClassElement element1, ClassElement element2) { | 487 bool visitClassElement( |
| 488 ClassElement element1, covariant ClassElement element2) { |
483 if (!strategy.test( | 489 if (!strategy.test( |
484 element1, | 490 element1, |
485 element2, | 491 element2, |
486 'isUnnamedMixinApplication', | 492 'isUnnamedMixinApplication', |
487 element1.isUnnamedMixinApplication, | 493 element1.isUnnamedMixinApplication, |
488 element2.isUnnamedMixinApplication)) { | 494 element2.isUnnamedMixinApplication)) { |
489 return false; | 495 return false; |
490 } | 496 } |
491 if (element1.isUnnamedMixinApplication) { | 497 if (element1.isUnnamedMixinApplication) { |
492 MixinApplicationElement mixin1 = element1; | 498 MixinApplicationElement mixin1 = element1; |
493 MixinApplicationElement mixin2 = element2; | 499 MixinApplicationElement mixin2 = element2; |
494 return strategy.testElements( | 500 return strategy.testElements( |
495 mixin1, mixin2, 'subclass', mixin1.subclass, mixin2.subclass) && | 501 mixin1, mixin2, 'subclass', mixin1.subclass, mixin2.subclass) && |
496 // Using the [mixinType] is more precise but requires the test to | 502 // Using the [mixinType] is more precise but requires the test to |
497 // handle self references: The identity of a type variable is based on | 503 // handle self references: The identity of a type variable is based on |
498 // its type declaration and if [mixin1] is generic the [mixinType] | 504 // its type declaration and if [mixin1] is generic the [mixinType] |
499 // will contain the type variables declared by [mixin1], i.e. | 505 // will contain the type variables declared by [mixin1], i.e. |
500 // `abstract class Mixin<T> implements MixinType<T> {}` | 506 // `abstract class Mixin<T> implements MixinType<T> {}` |
501 strategy.testElements( | 507 strategy.testElements( |
502 mixin1, mixin2, 'mixin', mixin1.mixin, mixin2.mixin); | 508 mixin1, mixin2, 'mixin', mixin1.mixin, mixin2.mixin); |
503 } else { | 509 } else { |
504 return strategy.test( | 510 return strategy.test( |
505 element1, element2, 'name', element1.name, element2.name) && | 511 element1, element2, 'name', element1.name, element2.name) && |
506 visit(element1.library, element2.library); | 512 visit(element1.library, element2.library); |
507 } | 513 } |
508 } | 514 } |
509 | 515 |
510 bool checkMembers(Element element1, Element element2) { | 516 bool checkMembers(Element element1, covariant Element element2) { |
511 if (!strategy.test( | 517 if (!strategy.test( |
512 element1, element2, 'name', element1.name, element2.name)) { | 518 element1, element2, 'name', element1.name, element2.name)) { |
513 return false; | 519 return false; |
514 } | 520 } |
515 if (element1.enclosingClass != null || element2.enclosingClass != null) { | 521 if (element1.enclosingClass != null || element2.enclosingClass != null) { |
516 return visit(element1.enclosingClass, element2.enclosingClass); | 522 return visit(element1.enclosingClass, element2.enclosingClass); |
517 } else { | 523 } else { |
518 return visit(element1.library, element2.library); | 524 return visit(element1.library, element2.library); |
519 } | 525 } |
520 } | 526 } |
521 | 527 |
522 @override | 528 @override |
523 bool visitFieldElement(FieldElement element1, FieldElement element2) { | 529 bool visitFieldElement( |
| 530 FieldElement element1, covariant FieldElement element2) { |
524 return checkMembers(element1, element2); | 531 return checkMembers(element1, element2); |
525 } | 532 } |
526 | 533 |
527 @override | 534 @override |
528 bool visitBoxFieldElement( | 535 bool visitBoxFieldElement( |
529 BoxFieldElement element1, BoxFieldElement element2) { | 536 BoxFieldElement element1, covariant BoxFieldElement element2) { |
530 return element1.box.name == element2.box.name && | 537 return element1.box.name == element2.box.name && |
531 visit(element1.box.executableContext, element2.box.executableContext) && | 538 visit(element1.box.executableContext, element2.box.executableContext) && |
532 visit(element1.variableElement, element2.variableElement); | 539 visit(element1.variableElement, element2.variableElement); |
533 } | 540 } |
534 | 541 |
535 @override | 542 @override |
536 bool visitConstructorElement( | 543 bool visitConstructorElement( |
537 ConstructorElement element1, ConstructorElement element2) { | 544 ConstructorElement element1, covariant ConstructorElement element2) { |
538 return checkMembers(element1, element2); | 545 return checkMembers(element1, element2); |
539 } | 546 } |
540 | 547 |
541 @override | 548 @override |
542 bool visitMethodElement(MethodElement element1, MethodElement element2) { | 549 bool visitMethodElement( |
| 550 covariant MethodElement element1, covariant MethodElement element2) { |
543 return checkMembers(element1, element2); | 551 return checkMembers(element1, element2); |
544 } | 552 } |
545 | 553 |
546 @override | 554 @override |
547 bool visitGetterElement(GetterElement element1, GetterElement element2) { | 555 bool visitGetterElement( |
| 556 GetterElement element1, covariant GetterElement element2) { |
548 return checkMembers(element1, element2); | 557 return checkMembers(element1, element2); |
549 } | 558 } |
550 | 559 |
551 @override | 560 @override |
552 bool visitSetterElement(SetterElement element1, SetterElement element2) { | 561 bool visitSetterElement( |
| 562 SetterElement element1, covariant SetterElement element2) { |
553 return checkMembers(element1, element2); | 563 return checkMembers(element1, element2); |
554 } | 564 } |
555 | 565 |
556 @override | 566 @override |
557 bool visitLocalFunctionElement( | 567 bool visitLocalFunctionElement( |
558 LocalFunctionElement element1, LocalFunctionElement element2) { | 568 LocalFunctionElement element1, covariant LocalFunctionElement element2) { |
559 // TODO(johnniwinther): Define an equivalence on locals. | 569 // TODO(johnniwinther): Define an equivalence on locals. |
560 MemberElement member1 = element1.memberContext; | 570 MemberElement member1 = element1.memberContext; |
561 MemberElement member2 = element2.memberContext; | 571 MemberElement member2 = element2.memberContext; |
562 return strategy.test( | 572 return strategy.test( |
563 element1, element2, 'name', element1.name, element2.name) && | 573 element1, element2, 'name', element1.name, element2.name) && |
564 checkMembers(member1, member2); | 574 checkMembers(member1, member2); |
565 } | 575 } |
566 | 576 |
567 @override | 577 @override |
568 bool visitLocalVariableElement( | 578 bool visitLocalVariableElement( |
569 LocalVariableElement element1, LocalVariableElement element2) { | 579 LocalVariableElement element1, covariant LocalVariableElement element2) { |
570 // TODO(johnniwinther): Define an equivalence on locals. | 580 // TODO(johnniwinther): Define an equivalence on locals. |
571 return strategy.test( | 581 return strategy.test( |
572 element1, element2, 'name', element1.name, element2.name) && | 582 element1, element2, 'name', element1.name, element2.name) && |
573 checkMembers(element1.memberContext, element2.memberContext); | 583 checkMembers(element1.memberContext, element2.memberContext); |
574 } | 584 } |
575 | 585 |
576 bool visitAbstractFieldElement( | 586 bool visitAbstractFieldElement( |
577 AbstractFieldElement element1, AbstractFieldElement element2) { | 587 AbstractFieldElement element1, covariant AbstractFieldElement element2) { |
578 return checkMembers(element1, element2); | 588 return checkMembers(element1, element2); |
579 } | 589 } |
580 | 590 |
581 @override | 591 @override |
582 bool visitTypeVariableElement( | 592 bool visitTypeVariableElement( |
583 TypeVariableElement element1, TypeVariableElement element2) { | 593 TypeVariableElement element1, covariant TypeVariableElement element2) { |
584 return strategy.test( | 594 return strategy.test( |
585 element1, element2, 'name', element1.name, element2.name) && | 595 element1, element2, 'name', element1.name, element2.name) && |
586 visit(element1.typeDeclaration, element2.typeDeclaration); | 596 visit(element1.typeDeclaration, element2.typeDeclaration); |
587 } | 597 } |
588 | 598 |
589 @override | 599 @override |
590 bool visitTypedefElement(TypedefElement element1, TypedefElement element2) { | 600 bool visitTypedefElement( |
| 601 TypedefElement element1, covariant TypedefElement element2) { |
591 return strategy.test( | 602 return strategy.test( |
592 element1, element2, 'name', element1.name, element2.name) && | 603 element1, element2, 'name', element1.name, element2.name) && |
593 visit(element1.library, element2.library); | 604 visit(element1.library, element2.library); |
594 } | 605 } |
595 | 606 |
596 @override | 607 @override |
597 bool visitParameterElement( | 608 bool visitParameterElement( |
598 ParameterElement element1, ParameterElement element2) { | 609 ParameterElement element1, covariant ParameterElement element2) { |
599 return strategy.test( | 610 return strategy.test( |
600 element1, element2, 'name', element1.name, element2.name) && | 611 element1, element2, 'name', element1.name, element2.name) && |
601 visit(element1.functionDeclaration, element2.functionDeclaration); | 612 visit(element1.functionDeclaration, element2.functionDeclaration); |
602 } | 613 } |
603 | 614 |
604 @override | 615 @override |
605 bool visitImportElement(ImportElement element1, ImportElement element2) { | 616 bool visitImportElement( |
| 617 ImportElement element1, covariant ImportElement element2) { |
606 return visit(element1.importedLibrary, element2.importedLibrary) && | 618 return visit(element1.importedLibrary, element2.importedLibrary) && |
607 visit(element1.library, element2.library); | 619 visit(element1.library, element2.library); |
608 } | 620 } |
609 | 621 |
610 @override | 622 @override |
611 bool visitExportElement(ExportElement element1, ExportElement element2) { | 623 bool visitExportElement( |
| 624 ExportElement element1, covariant ExportElement element2) { |
612 return visit(element1.exportedLibrary, element2.exportedLibrary) && | 625 return visit(element1.exportedLibrary, element2.exportedLibrary) && |
613 visit(element1.library, element2.library); | 626 visit(element1.library, element2.library); |
614 } | 627 } |
615 | 628 |
616 @override | 629 @override |
617 bool visitPrefixElement(PrefixElement element1, PrefixElement element2) { | 630 bool visitPrefixElement( |
| 631 PrefixElement element1, covariant PrefixElement element2) { |
618 return strategy.test( | 632 return strategy.test( |
619 element1, element2, 'name', element1.name, element2.name) && | 633 element1, element2, 'name', element1.name, element2.name) && |
620 visit(element1.library, element2.library); | 634 visit(element1.library, element2.library); |
621 } | 635 } |
622 | 636 |
623 @override | 637 @override |
624 bool visitErroneousElement( | 638 bool visitErroneousElement( |
625 ErroneousElement element1, ErroneousElement element2) { | 639 ErroneousElement element1, covariant ErroneousElement element2) { |
626 return strategy.test(element1, element2, 'messageKind', | 640 return strategy.test(element1, element2, 'messageKind', |
627 element1.messageKind, element2.messageKind); | 641 element1.messageKind, element2.messageKind); |
628 } | 642 } |
629 | 643 |
630 @override | 644 @override |
631 bool visitWarnOnUseElement( | 645 bool visitWarnOnUseElement( |
632 WarnOnUseElement element1, WarnOnUseElement element2) { | 646 WarnOnUseElement element1, covariant WarnOnUseElement element2) { |
633 return strategy.testElements(element1, element2, 'wrappedElement', | 647 return strategy.testElements(element1, element2, 'wrappedElement', |
634 element1.wrappedElement, element2.wrappedElement); | 648 element1.wrappedElement, element2.wrappedElement); |
635 } | 649 } |
636 } | 650 } |
637 | 651 |
638 /// Visitor that checks for equivalence of [ResolutionDartType]s. | 652 /// Visitor that checks for equivalence of [ResolutionDartType]s. |
639 class TypeEquivalence | 653 class TypeEquivalence |
640 implements ResolutionDartTypeVisitor<bool, ResolutionDartType> { | 654 implements ResolutionDartTypeVisitor<bool, ResolutionDartType> { |
641 final TestStrategy strategy; | 655 final TestStrategy strategy; |
642 | 656 |
643 const TypeEquivalence([this.strategy = const TestStrategy()]); | 657 const TypeEquivalence([this.strategy = const TestStrategy()]); |
644 | 658 |
645 bool visit(ResolutionDartType type1, ResolutionDartType type2) { | 659 bool visit( |
| 660 covariant ResolutionDartType type1, covariant ResolutionDartType type2) { |
646 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) && | 661 return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) && |
647 type1.accept(this, type2); | 662 type1.accept(this, type2); |
648 } | 663 } |
649 | 664 |
650 @override | 665 @override |
651 bool visitDynamicType( | 666 bool visitDynamicType(covariant ResolutionDynamicType type, |
652 ResolutionDynamicType type, ResolutionDynamicType other) => | 667 covariant ResolutionDynamicType other) => |
653 true; | 668 true; |
654 | 669 |
655 @override | 670 @override |
656 bool visitFunctionType( | 671 bool visitFunctionType(covariant ResolutionFunctionType type, |
657 ResolutionFunctionType type, ResolutionFunctionType other) { | 672 covariant ResolutionFunctionType other) { |
658 return strategy.testTypeLists(type, other, 'parameterTypes', | 673 return strategy.testTypeLists(type, other, 'parameterTypes', |
659 type.parameterTypes, other.parameterTypes) && | 674 type.parameterTypes, other.parameterTypes) && |
660 strategy.testTypeLists(type, other, 'optionalParameterTypes', | 675 strategy.testTypeLists(type, other, 'optionalParameterTypes', |
661 type.optionalParameterTypes, other.optionalParameterTypes) && | 676 type.optionalParameterTypes, other.optionalParameterTypes) && |
662 strategy.testTypeLists(type, other, 'namedParameterTypes', | 677 strategy.testTypeLists(type, other, 'namedParameterTypes', |
663 type.namedParameterTypes, other.namedParameterTypes) && | 678 type.namedParameterTypes, other.namedParameterTypes) && |
664 strategy.testLists(type, other, 'namedParameters', type.namedParameters, | 679 strategy.testLists(type, other, 'namedParameters', type.namedParameters, |
665 other.namedParameters); | 680 other.namedParameters); |
666 } | 681 } |
667 | 682 |
668 bool visitGenericType(GenericType type, GenericType other) { | 683 bool visitGenericType(GenericType type, GenericType other) { |
669 return strategy.testElements( | 684 return strategy.testElements( |
670 type, other, 'element', type.element, other.element) && | 685 type, other, 'element', type.element, other.element) && |
671 strategy.testTypeLists(type, other, 'typeArguments', type.typeArguments, | 686 strategy.testTypeLists(type, other, 'typeArguments', type.typeArguments, |
672 other.typeArguments); | 687 other.typeArguments); |
673 } | 688 } |
674 | 689 |
675 @override | 690 @override |
676 bool visitMalformedType(MalformedType type, MalformedType other) => true; | 691 bool visitMalformedType(MalformedType type, covariant MalformedType other) => |
| 692 true; |
677 | 693 |
678 @override | 694 @override |
679 bool visitTypeVariableType( | 695 bool visitTypeVariableType(covariant ResolutionTypeVariableType type, |
680 ResolutionTypeVariableType type, ResolutionTypeVariableType other) { | 696 covariant ResolutionTypeVariableType other) { |
681 return strategy.testElements( | 697 return strategy.testElements( |
682 type, other, 'element', type.element, other.element) && | 698 type, other, 'element', type.element, other.element) && |
683 strategy.test(type, other, 'is MethodTypeVariableType', | 699 strategy.test(type, other, 'is MethodTypeVariableType', |
684 type is MethodTypeVariableType, other is MethodTypeVariableType); | 700 type is MethodTypeVariableType, other is MethodTypeVariableType); |
685 } | 701 } |
686 | 702 |
687 @override | 703 @override |
688 bool visitVoidType(ResolutionVoidType type, ResolutionVoidType argument) => | 704 bool visitVoidType(covariant ResolutionVoidType type, |
| 705 covariant ResolutionVoidType argument) => |
689 true; | 706 true; |
690 | 707 |
691 @override | 708 @override |
692 bool visitInterfaceType( | 709 bool visitInterfaceType(covariant ResolutionInterfaceType type, |
693 ResolutionInterfaceType type, ResolutionInterfaceType other) { | 710 covariant ResolutionInterfaceType other) { |
694 return visitGenericType(type, other); | 711 return visitGenericType(type, other); |
695 } | 712 } |
696 | 713 |
697 @override | 714 @override |
698 bool visitTypedefType( | 715 bool visitTypedefType( |
699 ResolutionTypedefType type, ResolutionTypedefType other) { | 716 ResolutionTypedefType type, covariant ResolutionTypedefType other) { |
700 return visitGenericType(type, other); | 717 return visitGenericType(type, other); |
701 } | 718 } |
702 } | 719 } |
703 | 720 |
704 /// Visitor that checks for structural equivalence of [ConstantExpression]s. | 721 /// Visitor that checks for structural equivalence of [ConstantExpression]s. |
705 class ConstantEquivalence | 722 class ConstantEquivalence |
706 implements ConstantExpressionVisitor<bool, ConstantExpression> { | 723 implements ConstantExpressionVisitor<bool, ConstantExpression> { |
707 final TestStrategy strategy; | 724 final TestStrategy strategy; |
708 | 725 |
709 const ConstantEquivalence([this.strategy = const TestStrategy()]); | 726 const ConstantEquivalence([this.strategy = const TestStrategy()]); |
710 | 727 |
711 @override | 728 @override |
712 bool visit(ConstantExpression exp1, ConstantExpression exp2) { | 729 bool visit(ConstantExpression exp1, covariant ConstantExpression exp2) { |
713 if (identical(exp1, exp2)) return true; | 730 if (identical(exp1, exp2)) return true; |
714 return strategy.test(exp1, exp2, 'kind', exp1.kind, exp2.kind) && | 731 return strategy.test(exp1, exp2, 'kind', exp1.kind, exp2.kind) && |
715 exp1.accept(this, exp2); | 732 exp1.accept(this, exp2); |
716 } | 733 } |
717 | 734 |
718 @override | 735 @override |
719 bool visitBinary( | 736 bool visitBinary( |
720 BinaryConstantExpression exp1, BinaryConstantExpression exp2) { | 737 BinaryConstantExpression exp1, covariant BinaryConstantExpression exp2) { |
721 return strategy.test( | 738 return strategy.test( |
722 exp1, exp2, 'operator', exp1.operator, exp2.operator) && | 739 exp1, exp2, 'operator', exp1.operator, exp2.operator) && |
723 strategy.testConstants(exp1, exp2, 'left', exp1.left, exp2.left) && | 740 strategy.testConstants(exp1, exp2, 'left', exp1.left, exp2.left) && |
724 strategy.testConstants(exp1, exp2, 'right', exp1.right, exp2.right); | 741 strategy.testConstants(exp1, exp2, 'right', exp1.right, exp2.right); |
725 } | 742 } |
726 | 743 |
727 @override | 744 @override |
728 bool visitConcatenate( | 745 bool visitConcatenate(ConcatenateConstantExpression exp1, |
729 ConcatenateConstantExpression exp1, ConcatenateConstantExpression exp2) { | 746 covariant ConcatenateConstantExpression exp2) { |
730 return strategy.testConstantLists( | 747 return strategy.testConstantLists( |
731 exp1, exp2, 'expressions', exp1.expressions, exp2.expressions); | 748 exp1, exp2, 'expressions', exp1.expressions, exp2.expressions); |
732 } | 749 } |
733 | 750 |
734 @override | 751 @override |
735 bool visitConditional( | 752 bool visitConditional(ConditionalConstantExpression exp1, |
736 ConditionalConstantExpression exp1, ConditionalConstantExpression exp2) { | 753 covariant ConditionalConstantExpression exp2) { |
737 return strategy.testConstants( | 754 return strategy.testConstants( |
738 exp1, exp2, 'condition', exp1.condition, exp2.condition) && | 755 exp1, exp2, 'condition', exp1.condition, exp2.condition) && |
739 strategy.testConstants( | 756 strategy.testConstants( |
740 exp1, exp2, 'trueExp', exp1.trueExp, exp2.trueExp) && | 757 exp1, exp2, 'trueExp', exp1.trueExp, exp2.trueExp) && |
741 strategy.testConstants( | 758 strategy.testConstants( |
742 exp1, exp2, 'falseExp', exp1.falseExp, exp2.falseExp); | 759 exp1, exp2, 'falseExp', exp1.falseExp, exp2.falseExp); |
743 } | 760 } |
744 | 761 |
745 @override | 762 @override |
746 bool visitConstructed( | 763 bool visitConstructed(ConstructedConstantExpression exp1, |
747 ConstructedConstantExpression exp1, ConstructedConstantExpression exp2) { | 764 covariant ConstructedConstantExpression exp2) { |
748 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && | 765 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && |
749 strategy.testElements(exp1, exp2, 'target', exp1.target, exp2.target) && | 766 strategy.testElements(exp1, exp2, 'target', exp1.target, exp2.target) && |
750 strategy.testConstantLists( | 767 strategy.testConstantLists( |
751 exp1, exp2, 'arguments', exp1.arguments, exp2.arguments) && | 768 exp1, exp2, 'arguments', exp1.arguments, exp2.arguments) && |
752 strategy.test(exp1, exp2, 'callStructure', exp1.callStructure, | 769 strategy.test(exp1, exp2, 'callStructure', exp1.callStructure, |
753 exp2.callStructure); | 770 exp2.callStructure); |
754 } | 771 } |
755 | 772 |
756 @override | 773 @override |
757 bool visitFunction( | 774 bool visitFunction(FunctionConstantExpression exp1, |
758 FunctionConstantExpression exp1, FunctionConstantExpression exp2) { | 775 covariant FunctionConstantExpression exp2) { |
759 return strategy.testElements( | 776 return strategy.testElements( |
760 exp1, exp2, 'element', exp1.element, exp2.element); | 777 exp1, exp2, 'element', exp1.element, exp2.element); |
761 } | 778 } |
762 | 779 |
763 @override | 780 @override |
764 bool visitIdentical( | 781 bool visitIdentical(IdenticalConstantExpression exp1, |
765 IdenticalConstantExpression exp1, IdenticalConstantExpression exp2) { | 782 covariant IdenticalConstantExpression exp2) { |
766 return strategy.testConstants(exp1, exp2, 'left', exp1.left, exp2.left) && | 783 return strategy.testConstants(exp1, exp2, 'left', exp1.left, exp2.left) && |
767 strategy.testConstants(exp1, exp2, 'right', exp1.right, exp2.right); | 784 strategy.testConstants(exp1, exp2, 'right', exp1.right, exp2.right); |
768 } | 785 } |
769 | 786 |
770 @override | 787 @override |
771 bool visitList(ListConstantExpression exp1, ListConstantExpression exp2) { | 788 bool visitList( |
| 789 ListConstantExpression exp1, covariant ListConstantExpression exp2) { |
772 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && | 790 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && |
773 strategy.testConstantLists( | 791 strategy.testConstantLists( |
774 exp1, exp2, 'values', exp1.values, exp2.values); | 792 exp1, exp2, 'values', exp1.values, exp2.values); |
775 } | 793 } |
776 | 794 |
777 @override | 795 @override |
778 bool visitMap(MapConstantExpression exp1, MapConstantExpression exp2) { | 796 bool visitMap( |
| 797 MapConstantExpression exp1, covariant MapConstantExpression exp2) { |
779 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && | 798 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type) && |
780 strategy.testConstantLists(exp1, exp2, 'keys', exp1.keys, exp2.keys) && | 799 strategy.testConstantLists(exp1, exp2, 'keys', exp1.keys, exp2.keys) && |
781 strategy.testConstantLists( | 800 strategy.testConstantLists( |
782 exp1, exp2, 'values', exp1.values, exp2.values); | 801 exp1, exp2, 'values', exp1.values, exp2.values); |
783 } | 802 } |
784 | 803 |
785 @override | 804 @override |
786 bool visitNamed(NamedArgumentReference exp1, NamedArgumentReference exp2) { | 805 bool visitNamed( |
| 806 NamedArgumentReference exp1, covariant NamedArgumentReference exp2) { |
787 return strategy.test(exp1, exp2, 'name', exp1.name, exp2.name); | 807 return strategy.test(exp1, exp2, 'name', exp1.name, exp2.name); |
788 } | 808 } |
789 | 809 |
790 @override | 810 @override |
791 bool visitPositional( | 811 bool visitPositional(PositionalArgumentReference exp1, |
792 PositionalArgumentReference exp1, PositionalArgumentReference exp2) { | 812 covariant PositionalArgumentReference exp2) { |
793 return strategy.test(exp1, exp2, 'index', exp1.index, exp2.index); | 813 return strategy.test(exp1, exp2, 'index', exp1.index, exp2.index); |
794 } | 814 } |
795 | 815 |
796 @override | 816 @override |
797 bool visitSymbol( | 817 bool visitSymbol( |
798 SymbolConstantExpression exp1, SymbolConstantExpression exp2) { | 818 SymbolConstantExpression exp1, covariant SymbolConstantExpression exp2) { |
799 // TODO(johnniwinther): Handle private names. Currently not even supported | 819 // TODO(johnniwinther): Handle private names. Currently not even supported |
800 // in resolution. | 820 // in resolution. |
801 return strategy.test(exp1, exp2, 'name', exp1.name, exp2.name); | 821 return strategy.test(exp1, exp2, 'name', exp1.name, exp2.name); |
802 } | 822 } |
803 | 823 |
804 @override | 824 @override |
805 bool visitType(TypeConstantExpression exp1, TypeConstantExpression exp2) { | 825 bool visitType( |
| 826 TypeConstantExpression exp1, covariant TypeConstantExpression exp2) { |
806 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type); | 827 return strategy.testTypes(exp1, exp2, 'type', exp1.type, exp2.type); |
807 } | 828 } |
808 | 829 |
809 @override | 830 @override |
810 bool visitUnary(UnaryConstantExpression exp1, UnaryConstantExpression exp2) { | 831 bool visitUnary( |
| 832 UnaryConstantExpression exp1, covariant UnaryConstantExpression exp2) { |
811 return strategy.test( | 833 return strategy.test( |
812 exp1, exp2, 'operator', exp1.operator, exp2.operator) && | 834 exp1, exp2, 'operator', exp1.operator, exp2.operator) && |
813 strategy.testConstants( | 835 strategy.testConstants( |
814 exp1, exp2, 'expression', exp1.expression, exp2.expression); | 836 exp1, exp2, 'expression', exp1.expression, exp2.expression); |
815 } | 837 } |
816 | 838 |
817 @override | 839 @override |
818 bool visitField(FieldConstantExpression exp1, FieldConstantExpression exp2) { | 840 bool visitField( |
| 841 FieldConstantExpression exp1, covariant FieldConstantExpression exp2) { |
819 return strategy.testElements( | 842 return strategy.testElements( |
820 exp1, exp2, 'element', exp1.element, exp2.element); | 843 exp1, exp2, 'element', exp1.element, exp2.element); |
821 } | 844 } |
822 | 845 |
823 @override | 846 @override |
824 bool visitLocalVariable(LocalVariableConstantExpression exp1, | 847 bool visitLocalVariable(LocalVariableConstantExpression exp1, |
825 LocalVariableConstantExpression exp2) { | 848 covariant LocalVariableConstantExpression exp2) { |
826 return strategy.testElements( | 849 return strategy.testElements( |
827 exp1, exp2, 'element', exp1.element, exp2.element); | 850 exp1, exp2, 'element', exp1.element, exp2.element); |
828 } | 851 } |
829 | 852 |
830 @override | 853 @override |
831 bool visitBool(BoolConstantExpression exp1, BoolConstantExpression exp2) { | 854 bool visitBool( |
| 855 BoolConstantExpression exp1, covariant BoolConstantExpression exp2) { |
832 return strategy.test( | 856 return strategy.test( |
833 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); | 857 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); |
834 } | 858 } |
835 | 859 |
836 @override | 860 @override |
837 bool visitDouble( | 861 bool visitDouble( |
838 DoubleConstantExpression exp1, DoubleConstantExpression exp2) { | 862 DoubleConstantExpression exp1, covariant DoubleConstantExpression exp2) { |
839 return strategy.test( | 863 return strategy.test( |
840 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); | 864 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); |
841 } | 865 } |
842 | 866 |
843 @override | 867 @override |
844 bool visitInt(IntConstantExpression exp1, IntConstantExpression exp2) { | 868 bool visitInt( |
| 869 IntConstantExpression exp1, covariant IntConstantExpression exp2) { |
845 return strategy.test( | 870 return strategy.test( |
846 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); | 871 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); |
847 } | 872 } |
848 | 873 |
849 @override | 874 @override |
850 bool visitNull(NullConstantExpression exp1, NullConstantExpression exp2) { | 875 bool visitNull( |
| 876 NullConstantExpression exp1, covariant NullConstantExpression exp2) { |
851 return true; | 877 return true; |
852 } | 878 } |
853 | 879 |
854 @override | 880 @override |
855 bool visitString( | 881 bool visitString( |
856 StringConstantExpression exp1, StringConstantExpression exp2) { | 882 StringConstantExpression exp1, covariant StringConstantExpression exp2) { |
857 return strategy.test( | 883 return strategy.test( |
858 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); | 884 exp1, exp2, 'primitiveValue', exp1.primitiveValue, exp2.primitiveValue); |
859 } | 885 } |
860 | 886 |
861 @override | 887 @override |
862 bool visitBoolFromEnvironment(BoolFromEnvironmentConstantExpression exp1, | 888 bool visitBoolFromEnvironment(BoolFromEnvironmentConstantExpression exp1, |
863 BoolFromEnvironmentConstantExpression exp2) { | 889 covariant BoolFromEnvironmentConstantExpression exp2) { |
864 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && | 890 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && |
865 strategy.testConstants( | 891 strategy.testConstants( |
866 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); | 892 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); |
867 } | 893 } |
868 | 894 |
869 @override | 895 @override |
870 bool visitIntFromEnvironment(IntFromEnvironmentConstantExpression exp1, | 896 bool visitIntFromEnvironment(IntFromEnvironmentConstantExpression exp1, |
871 IntFromEnvironmentConstantExpression exp2) { | 897 covariant IntFromEnvironmentConstantExpression exp2) { |
872 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && | 898 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && |
873 strategy.testConstants( | 899 strategy.testConstants( |
874 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); | 900 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); |
875 } | 901 } |
876 | 902 |
877 @override | 903 @override |
878 bool visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp1, | 904 bool visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp1, |
879 StringFromEnvironmentConstantExpression exp2) { | 905 covariant StringFromEnvironmentConstantExpression exp2) { |
880 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && | 906 return strategy.testConstants(exp1, exp2, 'name', exp1.name, exp2.name) && |
881 strategy.testConstants( | 907 strategy.testConstants( |
882 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); | 908 exp1, exp2, 'defaultValue', exp1.defaultValue, exp2.defaultValue); |
883 } | 909 } |
884 | 910 |
885 @override | 911 @override |
886 bool visitStringLength(StringLengthConstantExpression exp1, | 912 bool visitStringLength(StringLengthConstantExpression exp1, |
887 StringLengthConstantExpression exp2) { | 913 covariant StringLengthConstantExpression exp2) { |
888 return strategy.testConstants( | 914 return strategy.testConstants( |
889 exp1, exp2, 'expression', exp1.expression, exp2.expression); | 915 exp1, exp2, 'expression', exp1.expression, exp2.expression); |
890 } | 916 } |
891 | 917 |
892 @override | 918 @override |
893 bool visitDeferred( | 919 bool visitDeferred(DeferredConstantExpression exp1, |
894 DeferredConstantExpression exp1, DeferredConstantExpression exp2) { | 920 covariant DeferredConstantExpression exp2) { |
895 return strategy.testElements( | 921 return strategy.testElements( |
896 exp1, exp2, 'prefix', exp1.prefix, exp2.prefix) && | 922 exp1, exp2, 'prefix', exp1.prefix, exp2.prefix) && |
897 strategy.testConstants( | 923 strategy.testConstants( |
898 exp1, exp2, 'expression', exp1.expression, exp2.expression); | 924 exp1, exp2, 'expression', exp1.expression, exp2.expression); |
899 } | 925 } |
900 } | 926 } |
901 | 927 |
902 /// Visitor that checks for structural equivalence of [ConstantValue]s. | 928 /// Visitor that checks for structural equivalence of [ConstantValue]s. |
903 class ConstantValueEquivalence | 929 class ConstantValueEquivalence |
904 implements ConstantValueVisitor<bool, ConstantValue> { | 930 implements ConstantValueVisitor<bool, ConstantValue> { |
905 final TestStrategy strategy; | 931 final TestStrategy strategy; |
906 | 932 |
907 const ConstantValueEquivalence([this.strategy = const TestStrategy()]); | 933 const ConstantValueEquivalence([this.strategy = const TestStrategy()]); |
908 | 934 |
909 bool visit(ConstantValue value1, ConstantValue value2) { | 935 bool visit(ConstantValue value1, covariant ConstantValue value2) { |
910 if (identical(value1, value2)) return true; | 936 if (identical(value1, value2)) return true; |
911 return strategy.test(value1, value2, 'kind', value1.kind, value2.kind) && | 937 return strategy.test(value1, value2, 'kind', value1.kind, value2.kind) && |
912 value1.accept(this, value2); | 938 value1.accept(this, value2); |
913 } | 939 } |
914 | 940 |
915 @override | 941 @override |
916 bool visitConstructed( | 942 bool visitConstructed(ConstructedConstantValue value1, |
917 ConstructedConstantValue value1, ConstructedConstantValue value2) { | 943 covariant ConstructedConstantValue value2) { |
918 return strategy.testTypes( | 944 return strategy.testTypes( |
919 value1, value2, 'type', value1.type, value2.type) && | 945 value1, value2, 'type', value1.type, value2.type) && |
920 strategy.testMaps( | 946 strategy.testMaps( |
921 value1, | 947 value1, |
922 value2, | 948 value2, |
923 'fields', | 949 'fields', |
924 value1.fields, | 950 value1.fields, |
925 value2.fields, | 951 value2.fields, |
926 strategy.elementEquivalence, | 952 strategy.elementEquivalence, |
927 (a, b) => strategy.testConstantValues( | 953 (a, b) => strategy.testConstantValues( |
928 value1, value2, 'fields.values', a, b)); | 954 value1, value2, 'fields.values', a, b)); |
929 } | 955 } |
930 | 956 |
931 @override | 957 @override |
932 bool visitFunction( | 958 bool visitFunction( |
933 FunctionConstantValue value1, FunctionConstantValue value2) { | 959 FunctionConstantValue value1, covariant FunctionConstantValue value2) { |
934 return strategy.testElements( | 960 return strategy.testElements( |
935 value1, value2, 'element', value1.element, value2.element); | 961 value1, value2, 'element', value1.element, value2.element); |
936 } | 962 } |
937 | 963 |
938 @override | 964 @override |
939 bool visitList(ListConstantValue value1, ListConstantValue value2) { | 965 bool visitList(ListConstantValue value1, covariant ListConstantValue value2) { |
940 return strategy.testTypes( | 966 return strategy.testTypes( |
941 value1, value2, 'type', value1.type, value2.type) && | 967 value1, value2, 'type', value1.type, value2.type) && |
942 strategy.testConstantValueLists( | 968 strategy.testConstantValueLists( |
943 value1, value2, 'entries', value1.entries, value2.entries); | 969 value1, value2, 'entries', value1.entries, value2.entries); |
944 } | 970 } |
945 | 971 |
946 @override | 972 @override |
947 bool visitMap(MapConstantValue value1, MapConstantValue value2) { | 973 bool visitMap(MapConstantValue value1, covariant MapConstantValue value2) { |
948 return strategy.testTypes( | 974 return strategy.testTypes( |
949 value1, value2, 'type', value1.type, value2.type) && | 975 value1, value2, 'type', value1.type, value2.type) && |
950 strategy.testConstantValueLists( | 976 strategy.testConstantValueLists( |
951 value1, value2, 'keys', value1.keys, value2.keys) && | 977 value1, value2, 'keys', value1.keys, value2.keys) && |
952 strategy.testConstantValueLists( | 978 strategy.testConstantValueLists( |
953 value1, value2, 'values', value1.values, value2.values); | 979 value1, value2, 'values', value1.values, value2.values); |
954 } | 980 } |
955 | 981 |
956 @override | 982 @override |
957 bool visitType(TypeConstantValue value1, TypeConstantValue value2) { | 983 bool visitType(TypeConstantValue value1, covariant TypeConstantValue value2) { |
958 return strategy.testTypes(value1, value2, 'type', value1.type, value2.type); | 984 return strategy.testTypes(value1, value2, 'type', value1.type, value2.type); |
959 } | 985 } |
960 | 986 |
961 @override | 987 @override |
962 bool visitBool(BoolConstantValue value1, BoolConstantValue value2) { | 988 bool visitBool(BoolConstantValue value1, covariant BoolConstantValue value2) { |
963 return strategy.test(value1, value2, 'primitiveValue', | 989 return strategy.test(value1, value2, 'primitiveValue', |
964 value1.primitiveValue, value2.primitiveValue); | 990 value1.primitiveValue, value2.primitiveValue); |
965 } | 991 } |
966 | 992 |
967 @override | 993 @override |
968 bool visitDouble(DoubleConstantValue value1, DoubleConstantValue value2) { | 994 bool visitDouble( |
| 995 DoubleConstantValue value1, covariant DoubleConstantValue value2) { |
969 return strategy.test(value1, value2, 'primitiveValue', | 996 return strategy.test(value1, value2, 'primitiveValue', |
970 value1.primitiveValue, value2.primitiveValue); | 997 value1.primitiveValue, value2.primitiveValue); |
971 } | 998 } |
972 | 999 |
973 @override | 1000 @override |
974 bool visitInt(IntConstantValue value1, IntConstantValue value2) { | 1001 bool visitInt(IntConstantValue value1, covariant IntConstantValue value2) { |
975 return strategy.test(value1, value2, 'primitiveValue', | 1002 return strategy.test(value1, value2, 'primitiveValue', |
976 value1.primitiveValue, value2.primitiveValue); | 1003 value1.primitiveValue, value2.primitiveValue); |
977 } | 1004 } |
978 | 1005 |
979 @override | 1006 @override |
980 bool visitNull(NullConstantValue value1, NullConstantValue value2) { | 1007 bool visitNull(NullConstantValue value1, covariant NullConstantValue value2) { |
981 return true; | 1008 return true; |
982 } | 1009 } |
983 | 1010 |
984 @override | 1011 @override |
985 bool visitString(StringConstantValue value1, StringConstantValue value2) { | 1012 bool visitString( |
| 1013 StringConstantValue value1, covariant StringConstantValue value2) { |
986 return strategy.test(value1, value2, 'primitiveValue', | 1014 return strategy.test(value1, value2, 'primitiveValue', |
987 value1.primitiveValue, value2.primitiveValue); | 1015 value1.primitiveValue, value2.primitiveValue); |
988 } | 1016 } |
989 | 1017 |
990 @override | 1018 @override |
991 bool visitDeferred( | 1019 bool visitDeferred( |
992 DeferredConstantValue value1, DeferredConstantValue value2) { | 1020 DeferredConstantValue value1, covariant DeferredConstantValue value2) { |
993 return strategy.testElements( | 1021 return strategy.testElements( |
994 value1, value2, 'prefix', value1.prefix, value2.prefix) && | 1022 value1, value2, 'prefix', value1.prefix, value2.prefix) && |
995 strategy.testConstantValues( | 1023 strategy.testConstantValues( |
996 value1, value2, 'referenced', value1.referenced, value2.referenced); | 1024 value1, value2, 'referenced', value1.referenced, value2.referenced); |
997 } | 1025 } |
998 | 1026 |
999 @override | 1027 @override |
1000 bool visitNonConstant(NonConstantValue value1, NonConstantValue value2) { | 1028 bool visitNonConstant( |
| 1029 NonConstantValue value1, covariant NonConstantValue value2) { |
1001 return true; | 1030 return true; |
1002 } | 1031 } |
1003 | 1032 |
1004 @override | 1033 @override |
1005 bool visitSynthetic( | 1034 bool visitSynthetic( |
1006 SyntheticConstantValue value1, SyntheticConstantValue value2) { | 1035 SyntheticConstantValue value1, covariant SyntheticConstantValue value2) { |
1007 return strategy.test( | 1036 return strategy.test( |
1008 value1, value2, 'payload', value1.payload, value2.payload) && | 1037 value1, value2, 'payload', value1.payload, value2.payload) && |
1009 strategy.test( | 1038 strategy.test( |
1010 value1, value2, 'valueKind', value1.valueKind, value2.valueKind); | 1039 value1, value2, 'valueKind', value1.valueKind, value2.valueKind); |
1011 } | 1040 } |
1012 | 1041 |
1013 @override | 1042 @override |
1014 bool visitInterceptor( | 1043 bool visitInterceptor(InterceptorConstantValue value1, |
1015 InterceptorConstantValue value1, InterceptorConstantValue value2) { | 1044 covariant InterceptorConstantValue value2) { |
1016 return strategy.testElements(value1, value2, 'cls', value1.cls, value2.cls); | 1045 return strategy.testElements(value1, value2, 'cls', value1.cls, value2.cls); |
1017 } | 1046 } |
1018 } | 1047 } |
1019 | 1048 |
1020 /// Tests the equivalence of [impact1] and [impact2] using [strategy]. | 1049 /// Tests the equivalence of [impact1] and [impact2] using [strategy]. |
1021 bool testResolutionImpactEquivalence( | 1050 bool testResolutionImpactEquivalence( |
1022 ResolutionImpact impact1, ResolutionImpact impact2, | 1051 ResolutionImpact impact1, ResolutionImpact impact2, |
1023 {TestStrategy strategy = const TestStrategy()}) { | 1052 {TestStrategy strategy = const TestStrategy()}) { |
1024 return strategy.testSets(impact1, impact2, 'constSymbolNames', | 1053 return strategy.testSets(impact1, impact2, 'constSymbolNames', |
1025 impact1.constSymbolNames, impact2.constSymbolNames) && | 1054 impact1.constSymbolNames, impact2.constSymbolNames) && |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 if (t1 == t2) return true; | 1470 if (t1 == t2) return true; |
1442 if (t1 == null || t2 == null) return false; | 1471 if (t1 == null || t2 == null) return false; |
1443 return strategy.test( | 1472 return strategy.test( |
1444 t1, t2, 'charOffset', t1.charOffset, t2.charOffset) && | 1473 t1, t2, 'charOffset', t1.charOffset, t2.charOffset) && |
1445 strategy.test(t1, t2, 'info', t1.type, t2.type) && | 1474 strategy.test(t1, t2, 'info', t1.type, t2.type) && |
1446 strategy.test(t1, t2, 'value', t1.lexeme, t2.lexeme); | 1475 strategy.test(t1, t2, 'value', t1.lexeme, t2.lexeme); |
1447 }); | 1476 }); |
1448 } | 1477 } |
1449 | 1478 |
1450 @override | 1479 @override |
1451 bool visitAssert(Assert node1, Assert node2) { | 1480 bool visitAssert(Assert node1, covariant Assert node2) { |
1452 return testTokens(node1, node2, 'assertToken', node1.assertToken, | 1481 return testTokens(node1, node2, 'assertToken', node1.assertToken, |
1453 node2.assertToken) && | 1482 node2.assertToken) && |
1454 testNodes( | 1483 testNodes( |
1455 node1, node2, 'condition', node1.condition, node2.condition) && | 1484 node1, node2, 'condition', node1.condition, node2.condition) && |
1456 testNodes(node1, node2, 'message', node1.message, node2.message); | 1485 testNodes(node1, node2, 'message', node1.message, node2.message); |
1457 } | 1486 } |
1458 | 1487 |
1459 @override | 1488 @override |
1460 bool visitAsyncForIn(AsyncForIn node1, AsyncForIn node2) { | 1489 bool visitAsyncForIn(AsyncForIn node1, covariant AsyncForIn node2) { |
1461 return visitForIn(node1, node2) && | 1490 return visitForIn(node1, node2) && |
1462 testTokens( | 1491 testTokens( |
1463 node1, node2, 'awaitToken', node1.awaitToken, node2.awaitToken); | 1492 node1, node2, 'awaitToken', node1.awaitToken, node2.awaitToken); |
1464 } | 1493 } |
1465 | 1494 |
1466 @override | 1495 @override |
1467 bool visitAsyncModifier(AsyncModifier node1, AsyncModifier node2) { | 1496 bool visitAsyncModifier(AsyncModifier node1, covariant AsyncModifier node2) { |
1468 return testTokens( | 1497 return testTokens( |
1469 node1, node2, 'asyncToken', node1.asyncToken, node2.asyncToken) && | 1498 node1, node2, 'asyncToken', node1.asyncToken, node2.asyncToken) && |
1470 testTokens(node1, node2, 'starToken', node1.starToken, node2.starToken); | 1499 testTokens(node1, node2, 'starToken', node1.starToken, node2.starToken); |
1471 } | 1500 } |
1472 | 1501 |
1473 @override | 1502 @override |
1474 bool visitAwait(Await node1, Await node2) { | 1503 bool visitAwait(Await node1, covariant Await node2) { |
1475 return testTokens( | 1504 return testTokens( |
1476 node1, node2, 'awaitToken', node1.awaitToken, node2.awaitToken) && | 1505 node1, node2, 'awaitToken', node1.awaitToken, node2.awaitToken) && |
1477 testNodes( | 1506 testNodes( |
1478 node1, node2, 'expression', node1.expression, node2.expression); | 1507 node1, node2, 'expression', node1.expression, node2.expression); |
1479 } | 1508 } |
1480 | 1509 |
1481 @override | 1510 @override |
1482 bool visitBlock(Block node1, Block node2) { | 1511 bool visitBlock(Block node1, covariant Block node2) { |
1483 return testNodes( | 1512 return testNodes( |
1484 node1, node2, 'statements', node1.statements, node2.statements); | 1513 node1, node2, 'statements', node1.statements, node2.statements); |
1485 } | 1514 } |
1486 | 1515 |
1487 @override | 1516 @override |
1488 bool visitBreakStatement(BreakStatement node1, BreakStatement node2) { | 1517 bool visitBreakStatement( |
| 1518 BreakStatement node1, covariant BreakStatement node2) { |
1489 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, | 1519 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, |
1490 node2.keywordToken) && | 1520 node2.keywordToken) && |
1491 testNodes(node1, node2, 'target', node1.target, node2.target); | 1521 testNodes(node1, node2, 'target', node1.target, node2.target); |
1492 } | 1522 } |
1493 | 1523 |
1494 @override | 1524 @override |
1495 bool visitCascade(Cascade node1, Cascade node2) { | 1525 bool visitCascade(Cascade node1, covariant Cascade node2) { |
1496 return testNodes( | 1526 return testNodes( |
1497 node1, node2, 'expression', node1.expression, node2.expression); | 1527 node1, node2, 'expression', node1.expression, node2.expression); |
1498 } | 1528 } |
1499 | 1529 |
1500 @override | 1530 @override |
1501 bool visitCascadeReceiver(CascadeReceiver node1, CascadeReceiver node2) { | 1531 bool visitCascadeReceiver( |
| 1532 CascadeReceiver node1, covariant CascadeReceiver node2) { |
1502 return testTokens(node1, node2, 'cascadeOperator', node1.cascadeOperator, | 1533 return testTokens(node1, node2, 'cascadeOperator', node1.cascadeOperator, |
1503 node2.cascadeOperator) && | 1534 node2.cascadeOperator) && |
1504 testNodes( | 1535 testNodes( |
1505 node1, node2, 'expression', node1.expression, node2.expression); | 1536 node1, node2, 'expression', node1.expression, node2.expression); |
1506 } | 1537 } |
1507 | 1538 |
1508 @override | 1539 @override |
1509 bool visitCaseMatch(CaseMatch node1, CaseMatch node2) { | 1540 bool visitCaseMatch(CaseMatch node1, covariant CaseMatch node2) { |
1510 return testTokens(node1, node2, 'caseKeyword', node1.caseKeyword, | 1541 return testTokens(node1, node2, 'caseKeyword', node1.caseKeyword, |
1511 node2.caseKeyword) && | 1542 node2.caseKeyword) && |
1512 testNodes( | 1543 testNodes( |
1513 node1, node2, 'expression', node1.expression, node2.expression); | 1544 node1, node2, 'expression', node1.expression, node2.expression); |
1514 } | 1545 } |
1515 | 1546 |
1516 @override | 1547 @override |
1517 bool visitCatchBlock(CatchBlock node1, CatchBlock node2) { | 1548 bool visitCatchBlock(CatchBlock node1, covariant CatchBlock node2) { |
1518 return testTokens(node1, node2, 'catchKeyword', node1.catchKeyword, | 1549 return testTokens(node1, node2, 'catchKeyword', node1.catchKeyword, |
1519 node2.catchKeyword) && | 1550 node2.catchKeyword) && |
1520 testTokens( | 1551 testTokens( |
1521 node1, node2, 'onKeyword', node1.onKeyword, node2.onKeyword) && | 1552 node1, node2, 'onKeyword', node1.onKeyword, node2.onKeyword) && |
1522 testNodes(node1, node2, 'type', node1.type, node2.type) && | 1553 testNodes(node1, node2, 'type', node1.type, node2.type) && |
1523 testNodes(node1, node2, 'formals', node1.formals, node2.formals) && | 1554 testNodes(node1, node2, 'formals', node1.formals, node2.formals) && |
1524 testNodes(node1, node2, 'block', node1.block, node2.block); | 1555 testNodes(node1, node2, 'block', node1.block, node2.block); |
1525 } | 1556 } |
1526 | 1557 |
1527 @override | 1558 @override |
1528 bool visitClassNode(ClassNode node1, ClassNode node2) { | 1559 bool visitClassNode(ClassNode node1, covariant ClassNode node2) { |
1529 return testTokens( | 1560 return testTokens( |
1530 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && | 1561 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && |
1531 testTokens(node1, node2, 'extendsKeyword', node1.extendsKeyword, | 1562 testTokens(node1, node2, 'extendsKeyword', node1.extendsKeyword, |
1532 node2.extendsKeyword) && | 1563 node2.extendsKeyword) && |
1533 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1564 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1534 testNodes( | 1565 testNodes( |
1535 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && | 1566 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && |
1536 testNodes(node1, node2, 'name', node1.name, node2.name) && | 1567 testNodes(node1, node2, 'name', node1.name, node2.name) && |
1537 testNodes( | 1568 testNodes( |
1538 node1, node2, 'superclass', node1.superclass, node2.superclass) && | 1569 node1, node2, 'superclass', node1.superclass, node2.superclass) && |
1539 testNodes( | 1570 testNodes( |
1540 node1, node2, 'interfaces', node1.interfaces, node2.interfaces) && | 1571 node1, node2, 'interfaces', node1.interfaces, node2.interfaces) && |
1541 testNodes(node1, node2, 'typeParameters', node1.typeParameters, | 1572 testNodes(node1, node2, 'typeParameters', node1.typeParameters, |
1542 node2.typeParameters) && | 1573 node2.typeParameters) && |
1543 testNodes(node1, node2, 'body', node1.body, node2.body); | 1574 testNodes(node1, node2, 'body', node1.body, node2.body); |
1544 } | 1575 } |
1545 | 1576 |
1546 @override | 1577 @override |
1547 bool visitCombinator(Combinator node1, Combinator node2) { | 1578 bool visitCombinator(Combinator node1, covariant Combinator node2) { |
1548 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, | 1579 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, |
1549 node2.keywordToken) && | 1580 node2.keywordToken) && |
1550 testNodes( | 1581 testNodes( |
1551 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); | 1582 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); |
1552 } | 1583 } |
1553 | 1584 |
1554 @override | 1585 @override |
1555 bool visitConditional(Conditional node1, Conditional node2) { | 1586 bool visitConditional(Conditional node1, covariant Conditional node2) { |
1556 return testTokens(node1, node2, 'questionToken', node1.questionToken, | 1587 return testTokens(node1, node2, 'questionToken', node1.questionToken, |
1557 node2.questionToken) && | 1588 node2.questionToken) && |
1558 testTokens( | 1589 testTokens( |
1559 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && | 1590 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && |
1560 testNodes( | 1591 testNodes( |
1561 node1, node2, 'condition', node1.condition, node2.condition) && | 1592 node1, node2, 'condition', node1.condition, node2.condition) && |
1562 testNodes(node1, node2, 'thenExpression', node1.thenExpression, | 1593 testNodes(node1, node2, 'thenExpression', node1.thenExpression, |
1563 node2.thenExpression) && | 1594 node2.thenExpression) && |
1564 testNodes(node1, node2, 'elseExpression', node1.elseExpression, | 1595 testNodes(node1, node2, 'elseExpression', node1.elseExpression, |
1565 node2.elseExpression); | 1596 node2.elseExpression); |
1566 } | 1597 } |
1567 | 1598 |
1568 @override | 1599 @override |
1569 bool visitConditionalUri(ConditionalUri node1, ConditionalUri node2) { | 1600 bool visitConditionalUri( |
| 1601 ConditionalUri node1, covariant ConditionalUri node2) { |
1570 return testTokens(node1, node2, 'ifToken', node1.ifToken, node2.ifToken) && | 1602 return testTokens(node1, node2, 'ifToken', node1.ifToken, node2.ifToken) && |
1571 testNodes(node1, node2, 'key', node1.key, node2.key) && | 1603 testNodes(node1, node2, 'key', node1.key, node2.key) && |
1572 testNodes(node1, node2, 'value', node1.value, node2.value) && | 1604 testNodes(node1, node2, 'value', node1.value, node2.value) && |
1573 testNodes(node1, node2, 'uri', node1.uri, node2.uri); | 1605 testNodes(node1, node2, 'uri', node1.uri, node2.uri); |
1574 } | 1606 } |
1575 | 1607 |
1576 @override | 1608 @override |
1577 bool visitContinueStatement( | 1609 bool visitContinueStatement( |
1578 ContinueStatement node1, ContinueStatement node2) { | 1610 ContinueStatement node1, covariant ContinueStatement node2) { |
1579 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, | 1611 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, |
1580 node2.keywordToken) && | 1612 node2.keywordToken) && |
1581 testNodes(node1, node2, 'target', node1.target, node2.target); | 1613 testNodes(node1, node2, 'target', node1.target, node2.target); |
1582 } | 1614 } |
1583 | 1615 |
1584 @override | 1616 @override |
1585 bool visitDoWhile(DoWhile node1, DoWhile node2) { | 1617 bool visitDoWhile(DoWhile node1, covariant DoWhile node2) { |
1586 return testTokens( | 1618 return testTokens( |
1587 node1, node2, 'doKeyword', node1.doKeyword, node2.doKeyword) && | 1619 node1, node2, 'doKeyword', node1.doKeyword, node2.doKeyword) && |
1588 testTokens(node1, node2, 'whileKeyword', node1.whileKeyword, | 1620 testTokens(node1, node2, 'whileKeyword', node1.whileKeyword, |
1589 node2.whileKeyword) && | 1621 node2.whileKeyword) && |
1590 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1622 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1591 testNodes( | 1623 testNodes( |
1592 node1, node2, 'condition', node1.condition, node2.condition) && | 1624 node1, node2, 'condition', node1.condition, node2.condition) && |
1593 testNodes(node1, node2, 'body', node1.body, node2.body); | 1625 testNodes(node1, node2, 'body', node1.body, node2.body); |
1594 } | 1626 } |
1595 | 1627 |
1596 @override | 1628 @override |
1597 bool visitDottedName(DottedName node1, DottedName node2) { | 1629 bool visitDottedName(DottedName node1, covariant DottedName node2) { |
1598 return testTokens(node1, node2, 'token', node1.token, node2.token) && | 1630 return testTokens(node1, node2, 'token', node1.token, node2.token) && |
1599 testNodes( | 1631 testNodes( |
1600 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); | 1632 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); |
1601 } | 1633 } |
1602 | 1634 |
1603 @override | 1635 @override |
1604 bool visitEmptyStatement(EmptyStatement node1, EmptyStatement node2) { | 1636 bool visitEmptyStatement( |
| 1637 EmptyStatement node1, covariant EmptyStatement node2) { |
1605 return testTokens(node1, node2, 'semicolonToken', node1.semicolonToken, | 1638 return testTokens(node1, node2, 'semicolonToken', node1.semicolonToken, |
1606 node2.semicolonToken); | 1639 node2.semicolonToken); |
1607 } | 1640 } |
1608 | 1641 |
1609 @override | 1642 @override |
1610 bool visitEnum(Enum node1, Enum node2) { | 1643 bool visitEnum(Enum node1, covariant Enum node2) { |
1611 return testTokens( | 1644 return testTokens( |
1612 node1, node2, 'enumToken', node1.enumToken, node2.enumToken) && | 1645 node1, node2, 'enumToken', node1.enumToken, node2.enumToken) && |
1613 testNodes(node1, node2, 'name', node1.name, node2.name) && | 1646 testNodes(node1, node2, 'name', node1.name, node2.name) && |
1614 testNodes(node1, node2, 'names', node1.names, node2.names); | 1647 testNodes(node1, node2, 'names', node1.names, node2.names); |
1615 } | 1648 } |
1616 | 1649 |
1617 @override | 1650 @override |
1618 bool visitExport(Export node1, Export node2) { | 1651 bool visitExport(Export node1, covariant Export node2) { |
1619 return visitLibraryDependency(node1, node2) && | 1652 return visitLibraryDependency(node1, node2) && |
1620 testTokens(node1, node2, 'exportKeyword', node1.exportKeyword, | 1653 testTokens(node1, node2, 'exportKeyword', node1.exportKeyword, |
1621 node2.exportKeyword); | 1654 node2.exportKeyword); |
1622 } | 1655 } |
1623 | 1656 |
1624 @override | 1657 @override |
1625 bool visitExpressionStatement( | 1658 bool visitExpressionStatement( |
1626 ExpressionStatement node1, ExpressionStatement node2) { | 1659 ExpressionStatement node1, covariant ExpressionStatement node2) { |
1627 return testTokens( | 1660 return testTokens( |
1628 node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1661 node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1629 testNodes( | 1662 testNodes( |
1630 node1, node2, 'expression', node1.expression, node2.expression); | 1663 node1, node2, 'expression', node1.expression, node2.expression); |
1631 } | 1664 } |
1632 | 1665 |
1633 @override | 1666 @override |
1634 bool visitFor(For node1, For node2) { | 1667 bool visitFor(For node1, covariant For node2) { |
1635 return testTokens( | 1668 return testTokens( |
1636 node1, node2, 'forToken', node1.forToken, node2.forToken) && | 1669 node1, node2, 'forToken', node1.forToken, node2.forToken) && |
1637 testNodes(node1, node2, 'initializer', node1.initializer, | 1670 testNodes(node1, node2, 'initializer', node1.initializer, |
1638 node2.initializer) && | 1671 node2.initializer) && |
1639 testNodes(node1, node2, 'conditionStatement', node1.conditionStatement, | 1672 testNodes(node1, node2, 'conditionStatement', node1.conditionStatement, |
1640 node2.conditionStatement) && | 1673 node2.conditionStatement) && |
1641 testNodes(node1, node2, 'update', node1.update, node2.update) && | 1674 testNodes(node1, node2, 'update', node1.update, node2.update) && |
1642 testNodes(node1, node2, 'body', node1.body, node2.body); | 1675 testNodes(node1, node2, 'body', node1.body, node2.body); |
1643 } | 1676 } |
1644 | 1677 |
1645 @override | 1678 @override |
1646 bool visitForIn(ForIn node1, ForIn node2) { | 1679 bool visitForIn(ForIn node1, covariant ForIn node2) { |
1647 return testNodes( | 1680 return testNodes( |
1648 node1, node2, 'condition', node1.condition, node2.condition) && | 1681 node1, node2, 'condition', node1.condition, node2.condition) && |
1649 testNodes( | 1682 testNodes( |
1650 node1, node2, 'expression', node1.expression, node2.expression) && | 1683 node1, node2, 'expression', node1.expression, node2.expression) && |
1651 testNodes(node1, node2, 'body', node1.body, node2.body) && | 1684 testNodes(node1, node2, 'body', node1.body, node2.body) && |
1652 testNodes(node1, node2, 'declaredIdentifier', node1.declaredIdentifier, | 1685 testNodes(node1, node2, 'declaredIdentifier', node1.declaredIdentifier, |
1653 node2.declaredIdentifier); | 1686 node2.declaredIdentifier); |
1654 } | 1687 } |
1655 | 1688 |
1656 @override | 1689 @override |
1657 bool visitFunctionDeclaration( | 1690 bool visitFunctionDeclaration( |
1658 FunctionDeclaration node1, FunctionDeclaration node2) { | 1691 FunctionDeclaration node1, covariant FunctionDeclaration node2) { |
1659 return testNodes(node1, node2, 'function', node1.function, node2.function); | 1692 return testNodes(node1, node2, 'function', node1.function, node2.function); |
1660 } | 1693 } |
1661 | 1694 |
1662 @override | 1695 @override |
1663 bool visitFunctionExpression( | 1696 bool visitFunctionExpression( |
1664 FunctionExpression node1, FunctionExpression node2) { | 1697 FunctionExpression node1, covariant FunctionExpression node2) { |
1665 return testTokens( | 1698 return testTokens( |
1666 node1, node2, 'getOrSet', node1.getOrSet, node2.getOrSet) && | 1699 node1, node2, 'getOrSet', node1.getOrSet, node2.getOrSet) && |
1667 testNodes(node1, node2, 'name', node1.name, node2.name) && | 1700 testNodes(node1, node2, 'name', node1.name, node2.name) && |
1668 testNodes( | 1701 testNodes( |
1669 node1, node2, 'parameters', node1.parameters, node2.parameters) && | 1702 node1, node2, 'parameters', node1.parameters, node2.parameters) && |
1670 testNodes(node1, node2, 'body', node1.body, node2.body) && | 1703 testNodes(node1, node2, 'body', node1.body, node2.body) && |
1671 testNodes( | 1704 testNodes( |
1672 node1, node2, 'returnType', node1.returnType, node2.returnType) && | 1705 node1, node2, 'returnType', node1.returnType, node2.returnType) && |
1673 testNodes( | 1706 testNodes( |
1674 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && | 1707 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && |
1675 testNodes(node1, node2, 'initializers', node1.initializers, | 1708 testNodes(node1, node2, 'initializers', node1.initializers, |
1676 node2.initializers) && | 1709 node2.initializers) && |
1677 testNodes(node1, node2, 'asyncModifier', node1.asyncModifier, | 1710 testNodes(node1, node2, 'asyncModifier', node1.asyncModifier, |
1678 node2.asyncModifier); | 1711 node2.asyncModifier); |
1679 } | 1712 } |
1680 | 1713 |
1681 @override | 1714 @override |
1682 bool visitGotoStatement(GotoStatement node1, GotoStatement node2) { | 1715 bool visitGotoStatement(GotoStatement node1, covariant GotoStatement node2) { |
1683 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, | 1716 return testTokens(node1, node2, 'keywordToken', node1.keywordToken, |
1684 node2.keywordToken) && | 1717 node2.keywordToken) && |
1685 testTokens(node1, node2, 'semicolonToken', node1.semicolonToken, | 1718 testTokens(node1, node2, 'semicolonToken', node1.semicolonToken, |
1686 node2.semicolonToken) && | 1719 node2.semicolonToken) && |
1687 testNodes(node1, node2, 'target', node1.target, node2.target); | 1720 testNodes(node1, node2, 'target', node1.target, node2.target); |
1688 } | 1721 } |
1689 | 1722 |
1690 @override | 1723 @override |
1691 bool visitIdentifier(Identifier node1, Identifier node2) { | 1724 bool visitIdentifier(Identifier node1, covariant Identifier node2) { |
1692 return testTokens(node1, node2, 'token', node1.token, node2.token); | 1725 return testTokens(node1, node2, 'token', node1.token, node2.token); |
1693 } | 1726 } |
1694 | 1727 |
1695 @override | 1728 @override |
1696 bool visitIf(If node1, If node2) { | 1729 bool visitIf(If node1, covariant If node2) { |
1697 return testTokens(node1, node2, 'ifToken', node1.ifToken, node2.ifToken) && | 1730 return testTokens(node1, node2, 'ifToken', node1.ifToken, node2.ifToken) && |
1698 testTokens( | 1731 testTokens( |
1699 node1, node2, 'elseToken', node1.elseToken, node2.elseToken) && | 1732 node1, node2, 'elseToken', node1.elseToken, node2.elseToken) && |
1700 testNodes( | 1733 testNodes( |
1701 node1, node2, 'condition', node1.condition, node2.condition) && | 1734 node1, node2, 'condition', node1.condition, node2.condition) && |
1702 testNodes(node1, node2, 'thenPart', node1.thenPart, node2.thenPart) && | 1735 testNodes(node1, node2, 'thenPart', node1.thenPart, node2.thenPart) && |
1703 testNodes(node1, node2, 'elsePart', node1.elsePart, node2.elsePart); | 1736 testNodes(node1, node2, 'elsePart', node1.elsePart, node2.elsePart); |
1704 } | 1737 } |
1705 | 1738 |
1706 @override | 1739 @override |
1707 bool visitImport(Import node1, Import node2) { | 1740 bool visitImport(Import node1, covariant Import node2) { |
1708 return visitLibraryDependency(node1, node2) && | 1741 return visitLibraryDependency(node1, node2) && |
1709 testTokens(node1, node2, 'importKeyword', node1.importKeyword, | 1742 testTokens(node1, node2, 'importKeyword', node1.importKeyword, |
1710 node2.importKeyword) && | 1743 node2.importKeyword) && |
1711 testNodes(node1, node2, 'prefix', node1.prefix, node2.prefix) && | 1744 testNodes(node1, node2, 'prefix', node1.prefix, node2.prefix) && |
1712 strategy.test( | 1745 strategy.test( |
1713 node1, node2, 'isDeferred', node1.isDeferred, node2.isDeferred); | 1746 node1, node2, 'isDeferred', node1.isDeferred, node2.isDeferred); |
1714 } | 1747 } |
1715 | 1748 |
1716 @override | 1749 @override |
1717 bool visitLabel(Label node1, Label node2) { | 1750 bool visitLabel(Label node1, covariant Label node2) { |
1718 return testTokens( | 1751 return testTokens( |
1719 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && | 1752 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && |
1720 testNodes( | 1753 testNodes( |
1721 node1, node2, 'identifier', node1.identifier, node2.identifier); | 1754 node1, node2, 'identifier', node1.identifier, node2.identifier); |
1722 } | 1755 } |
1723 | 1756 |
1724 @override | 1757 @override |
1725 bool visitLabeledStatement(LabeledStatement node1, LabeledStatement node2) { | 1758 bool visitLabeledStatement( |
| 1759 LabeledStatement node1, covariant LabeledStatement node2) { |
1726 return testNodes(node1, node2, 'labels', node1.labels, node2.labels) && | 1760 return testNodes(node1, node2, 'labels', node1.labels, node2.labels) && |
1727 testNodes(node1, node2, 'statement', node1.statement, node2.statement); | 1761 testNodes(node1, node2, 'statement', node1.statement, node2.statement); |
1728 } | 1762 } |
1729 | 1763 |
1730 @override | 1764 @override |
1731 bool visitLibraryDependency( | 1765 bool visitLibraryDependency( |
1732 LibraryDependency node1, LibraryDependency node2) { | 1766 LibraryDependency node1, covariant LibraryDependency node2) { |
1733 return visitLibraryTag(node1, node2) && | 1767 return visitLibraryTag(node1, node2) && |
1734 testNodes(node1, node2, 'uri', node1.uri, node2.uri) && | 1768 testNodes(node1, node2, 'uri', node1.uri, node2.uri) && |
1735 testNodes(node1, node2, 'conditionalUris', node1.conditionalUris, | 1769 testNodes(node1, node2, 'conditionalUris', node1.conditionalUris, |
1736 node2.conditionalUris) && | 1770 node2.conditionalUris) && |
1737 testNodes( | 1771 testNodes( |
1738 node1, node2, 'combinators', node1.combinators, node2.combinators); | 1772 node1, node2, 'combinators', node1.combinators, node2.combinators); |
1739 } | 1773 } |
1740 | 1774 |
1741 @override | 1775 @override |
1742 bool visitLibraryName(LibraryName node1, LibraryName node2) { | 1776 bool visitLibraryName(LibraryName node1, covariant LibraryName node2) { |
1743 return visitLibraryTag(node1, node2) && | 1777 return visitLibraryTag(node1, node2) && |
1744 testTokens(node1, node2, 'libraryKeyword', node1.libraryKeyword, | 1778 testTokens(node1, node2, 'libraryKeyword', node1.libraryKeyword, |
1745 node2.libraryKeyword) && | 1779 node2.libraryKeyword) && |
1746 testNodes(node1, node2, 'name', node1.name, node2.name); | 1780 testNodes(node1, node2, 'name', node1.name, node2.name); |
1747 } | 1781 } |
1748 | 1782 |
1749 @override | 1783 @override |
1750 bool visitLibraryTag(LibraryTag node1, LibraryTag node2) { | 1784 bool visitLibraryTag(LibraryTag node1, covariant LibraryTag node2) { |
1751 // TODO(johnniwinther): Check metadata? | 1785 // TODO(johnniwinther): Check metadata? |
1752 return true; | 1786 return true; |
1753 } | 1787 } |
1754 | 1788 |
1755 @override | 1789 @override |
1756 bool visitLiteral(Literal node1, Literal node2) { | 1790 bool visitLiteral(Literal node1, covariant Literal node2) { |
1757 return testTokens(node1, node2, 'token', node1.token, node2.token); | 1791 return testTokens(node1, node2, 'token', node1.token, node2.token); |
1758 } | 1792 } |
1759 | 1793 |
1760 @override | 1794 @override |
1761 bool visitLiteralBool(LiteralBool node1, LiteralBool node2) { | 1795 bool visitLiteralBool(LiteralBool node1, covariant LiteralBool node2) { |
1762 return visitLiteral(node1, node2); | 1796 return visitLiteral(node1, node2); |
1763 } | 1797 } |
1764 | 1798 |
1765 @override | 1799 @override |
1766 bool visitLiteralDouble(LiteralDouble node1, LiteralDouble node2) { | 1800 bool visitLiteralDouble(LiteralDouble node1, covariant LiteralDouble node2) { |
1767 return visitLiteral(node1, node2); | 1801 return visitLiteral(node1, node2); |
1768 } | 1802 } |
1769 | 1803 |
1770 @override | 1804 @override |
1771 bool visitLiteralInt(LiteralInt node1, LiteralInt node2) { | 1805 bool visitLiteralInt(LiteralInt node1, covariant LiteralInt node2) { |
1772 return visitLiteral(node1, node2); | 1806 return visitLiteral(node1, node2); |
1773 } | 1807 } |
1774 | 1808 |
1775 @override | 1809 @override |
1776 bool visitLiteralList(LiteralList node1, LiteralList node2) { | 1810 bool visitLiteralList(LiteralList node1, covariant LiteralList node2) { |
1777 return testTokens(node1, node2, 'constKeyword', node1.constKeyword, | 1811 return testTokens(node1, node2, 'constKeyword', node1.constKeyword, |
1778 node2.constKeyword) && | 1812 node2.constKeyword) && |
1779 testNodes(node1, node2, 'typeArguments', node1.typeArguments, | 1813 testNodes(node1, node2, 'typeArguments', node1.typeArguments, |
1780 node2.typeArguments) && | 1814 node2.typeArguments) && |
1781 testNodes(node1, node2, 'elements', node1.elements, node2.elements); | 1815 testNodes(node1, node2, 'elements', node1.elements, node2.elements); |
1782 } | 1816 } |
1783 | 1817 |
1784 @override | 1818 @override |
1785 bool visitLiteralMap(LiteralMap node1, LiteralMap node2) { | 1819 bool visitLiteralMap(LiteralMap node1, covariant LiteralMap node2) { |
1786 return testTokens(node1, node2, 'constKeyword', node1.constKeyword, | 1820 return testTokens(node1, node2, 'constKeyword', node1.constKeyword, |
1787 node2.constKeyword) && | 1821 node2.constKeyword) && |
1788 testNodes(node1, node2, 'typeArguments', node1.typeArguments, | 1822 testNodes(node1, node2, 'typeArguments', node1.typeArguments, |
1789 node2.typeArguments) && | 1823 node2.typeArguments) && |
1790 testNodes(node1, node2, 'entries', node1.entries, node2.entries); | 1824 testNodes(node1, node2, 'entries', node1.entries, node2.entries); |
1791 } | 1825 } |
1792 | 1826 |
1793 @override | 1827 @override |
1794 bool visitLiteralMapEntry(LiteralMapEntry node1, LiteralMapEntry node2) { | 1828 bool visitLiteralMapEntry( |
| 1829 LiteralMapEntry node1, covariant LiteralMapEntry node2) { |
1795 return testTokens( | 1830 return testTokens( |
1796 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && | 1831 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && |
1797 testNodes(node1, node2, 'key', node1.key, node2.key) && | 1832 testNodes(node1, node2, 'key', node1.key, node2.key) && |
1798 testNodes(node1, node2, 'value', node1.value, node2.value); | 1833 testNodes(node1, node2, 'value', node1.value, node2.value); |
1799 } | 1834 } |
1800 | 1835 |
1801 @override | 1836 @override |
1802 bool visitLiteralNull(LiteralNull node1, LiteralNull node2) { | 1837 bool visitLiteralNull(LiteralNull node1, covariant LiteralNull node2) { |
1803 return visitLiteral(node1, node2); | 1838 return visitLiteral(node1, node2); |
1804 } | 1839 } |
1805 | 1840 |
1806 @override | 1841 @override |
1807 bool visitLiteralString(LiteralString node1, LiteralString node2) { | 1842 bool visitLiteralString(LiteralString node1, covariant LiteralString node2) { |
1808 return testTokens(node1, node2, 'token', node1.token, node2.token) && | 1843 return testTokens(node1, node2, 'token', node1.token, node2.token) && |
1809 strategy.test( | 1844 strategy.test( |
1810 node1, node2, 'dartString', node1.dartString, node2.dartString); | 1845 node1, node2, 'dartString', node1.dartString, node2.dartString); |
1811 } | 1846 } |
1812 | 1847 |
1813 @override | 1848 @override |
1814 bool visitLiteralSymbol(LiteralSymbol node1, LiteralSymbol node2) { | 1849 bool visitLiteralSymbol(LiteralSymbol node1, covariant LiteralSymbol node2) { |
1815 return testTokens( | 1850 return testTokens( |
1816 node1, node2, 'hashToken', node1.hashToken, node2.hashToken) && | 1851 node1, node2, 'hashToken', node1.hashToken, node2.hashToken) && |
1817 testNodes( | 1852 testNodes( |
1818 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); | 1853 node1, node2, 'identifiers', node1.identifiers, node2.identifiers); |
1819 } | 1854 } |
1820 | 1855 |
1821 @override | 1856 @override |
1822 bool visitLoop(Loop node1, Loop node2) { | 1857 bool visitLoop(Loop node1, covariant Loop node2) { |
1823 return testNodes( | 1858 return testNodes( |
1824 node1, node2, 'condition', node1.condition, node2.condition) && | 1859 node1, node2, 'condition', node1.condition, node2.condition) && |
1825 testNodes(node1, node2, 'body', node1.body, node2.body); | 1860 testNodes(node1, node2, 'body', node1.body, node2.body); |
1826 } | 1861 } |
1827 | 1862 |
1828 @override | 1863 @override |
1829 bool visitMetadata(Metadata node1, Metadata node2) { | 1864 bool visitMetadata(Metadata node1, covariant Metadata node2) { |
1830 return testTokens(node1, node2, 'token', node1.token, node2.token) && | 1865 return testTokens(node1, node2, 'token', node1.token, node2.token) && |
1831 testNodes( | 1866 testNodes( |
1832 node1, node2, 'expression', node1.expression, node2.expression); | 1867 node1, node2, 'expression', node1.expression, node2.expression); |
1833 } | 1868 } |
1834 | 1869 |
1835 @override | 1870 @override |
1836 bool visitMixinApplication(MixinApplication node1, MixinApplication node2) { | 1871 bool visitMixinApplication( |
| 1872 MixinApplication node1, covariant MixinApplication node2) { |
1837 return testNodes( | 1873 return testNodes( |
1838 node1, node2, 'superclass', node1.superclass, node2.superclass) && | 1874 node1, node2, 'superclass', node1.superclass, node2.superclass) && |
1839 testNodes(node1, node2, 'mixins', node1.mixins, node2.mixins); | 1875 testNodes(node1, node2, 'mixins', node1.mixins, node2.mixins); |
1840 } | 1876 } |
1841 | 1877 |
1842 @override | 1878 @override |
1843 bool visitModifiers(Modifiers node1, Modifiers node2) { | 1879 bool visitModifiers(Modifiers node1, covariant Modifiers node2) { |
1844 return strategy.test(node1, node2, 'flags', node1.flags, node2.flags) && | 1880 return strategy.test(node1, node2, 'flags', node1.flags, node2.flags) && |
1845 testNodes(node1, node2, 'nodes', node1.nodes, node2.nodes); | 1881 testNodes(node1, node2, 'nodes', node1.nodes, node2.nodes); |
1846 } | 1882 } |
1847 | 1883 |
1848 @override | 1884 @override |
1849 bool visitNamedArgument(NamedArgument node1, NamedArgument node2) { | 1885 bool visitNamedArgument(NamedArgument node1, covariant NamedArgument node2) { |
1850 return testTokens( | 1886 return testTokens( |
1851 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && | 1887 node1, node2, 'colonToken', node1.colonToken, node2.colonToken) && |
1852 testNodes(node1, node2, 'name', node1.name, node2.name) && | 1888 testNodes(node1, node2, 'name', node1.name, node2.name) && |
1853 testNodes( | 1889 testNodes( |
1854 node1, node2, 'expression', node1.expression, node2.expression); | 1890 node1, node2, 'expression', node1.expression, node2.expression); |
1855 } | 1891 } |
1856 | 1892 |
1857 @override | 1893 @override |
1858 bool visitNamedMixinApplication( | 1894 bool visitNamedMixinApplication( |
1859 NamedMixinApplication node1, NamedMixinApplication node2) { | 1895 NamedMixinApplication node1, covariant NamedMixinApplication node2) { |
1860 return testTokens(node1, node2, 'classKeyword', node1.classKeyword, | 1896 return testTokens(node1, node2, 'classKeyword', node1.classKeyword, |
1861 node2.classKeyword) && | 1897 node2.classKeyword) && |
1862 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1898 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1863 testNodes(node1, node2, 'name', node1.name, node2.name) && | 1899 testNodes(node1, node2, 'name', node1.name, node2.name) && |
1864 testNodes(node1, node2, 'typeParameters', node1.typeParameters, | 1900 testNodes(node1, node2, 'typeParameters', node1.typeParameters, |
1865 node2.typeParameters) && | 1901 node2.typeParameters) && |
1866 testNodes( | 1902 testNodes( |
1867 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && | 1903 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && |
1868 testNodes(node1, node2, 'mixinApplication', node1.mixinApplication, | 1904 testNodes(node1, node2, 'mixinApplication', node1.mixinApplication, |
1869 node2.mixinApplication) && | 1905 node2.mixinApplication) && |
1870 testNodes( | 1906 testNodes( |
1871 node1, node2, 'interfaces', node1.interfaces, node2.interfaces); | 1907 node1, node2, 'interfaces', node1.interfaces, node2.interfaces); |
1872 } | 1908 } |
1873 | 1909 |
1874 @override | 1910 @override |
1875 bool visitNewExpression(NewExpression node1, NewExpression node2) { | 1911 bool visitNewExpression(NewExpression node1, covariant NewExpression node2) { |
1876 return testTokens( | 1912 return testTokens( |
1877 node1, node2, 'newToken', node1.newToken, node2.newToken) && | 1913 node1, node2, 'newToken', node1.newToken, node2.newToken) && |
1878 testNodes(node1, node2, 'send', node1.send, node2.send); | 1914 testNodes(node1, node2, 'send', node1.send, node2.send); |
1879 } | 1915 } |
1880 | 1916 |
1881 @override | 1917 @override |
1882 bool visitNodeList(NodeList node1, NodeList node2) { | 1918 bool visitNodeList(NodeList node1, covariant NodeList node2) { |
1883 return testTokens( | 1919 return testTokens( |
1884 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && | 1920 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && |
1885 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1921 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1886 strategy.test( | 1922 strategy.test( |
1887 node1, node2, 'delimiter', node1.delimiter, node2.delimiter) && | 1923 node1, node2, 'delimiter', node1.delimiter, node2.delimiter) && |
1888 testNodeLists(node1, node2, 'nodes', node1.nodes, node2.nodes); | 1924 testNodeLists(node1, node2, 'nodes', node1.nodes, node2.nodes); |
1889 } | 1925 } |
1890 | 1926 |
1891 @override | 1927 @override |
1892 bool visitOperator(Operator node1, Operator node2) { | 1928 bool visitOperator(Operator node1, covariant Operator node2) { |
1893 return visitIdentifier(node1, node2); | 1929 return visitIdentifier(node1, node2); |
1894 } | 1930 } |
1895 | 1931 |
1896 @override | 1932 @override |
1897 bool visitParenthesizedExpression( | 1933 bool visitParenthesizedExpression( |
1898 ParenthesizedExpression node1, ParenthesizedExpression node2) { | 1934 ParenthesizedExpression node1, covariant ParenthesizedExpression node2) { |
1899 return testTokens( | 1935 return testTokens( |
1900 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && | 1936 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && |
1901 testNodes( | 1937 testNodes( |
1902 node1, node2, 'expression', node1.expression, node2.expression); | 1938 node1, node2, 'expression', node1.expression, node2.expression); |
1903 } | 1939 } |
1904 | 1940 |
1905 @override | 1941 @override |
1906 bool visitPart(Part node1, Part node2) { | 1942 bool visitPart(Part node1, covariant Part node2) { |
1907 return visitLibraryTag(node1, node2) && | 1943 return visitLibraryTag(node1, node2) && |
1908 testTokens(node1, node2, 'partKeyword', node1.partKeyword, | 1944 testTokens(node1, node2, 'partKeyword', node1.partKeyword, |
1909 node2.partKeyword) && | 1945 node2.partKeyword) && |
1910 testNodes(node1, node2, 'uri', node1.uri, node2.uri); | 1946 testNodes(node1, node2, 'uri', node1.uri, node2.uri); |
1911 } | 1947 } |
1912 | 1948 |
1913 @override | 1949 @override |
1914 bool visitPartOf(PartOf node1, PartOf node2) { | 1950 bool visitPartOf(PartOf node1, covariant PartOf node2) { |
1915 // TODO(johnniwinther): Check metadata? | 1951 // TODO(johnniwinther): Check metadata? |
1916 return testTokens(node1, node2, 'partKeyword', node1.partKeyword, | 1952 return testTokens(node1, node2, 'partKeyword', node1.partKeyword, |
1917 node2.partKeyword) && | 1953 node2.partKeyword) && |
1918 testNodes(node1, node2, 'name', node1.name, node2.name); | 1954 testNodes(node1, node2, 'name', node1.name, node2.name); |
1919 } | 1955 } |
1920 | 1956 |
1921 @override | 1957 @override |
1922 bool visitPostfix(Postfix node1, Postfix node2) { | 1958 bool visitPostfix(Postfix node1, covariant Postfix node2) { |
1923 return visitNodeList(node1, node2); | 1959 return visitNodeList(node1, node2); |
1924 } | 1960 } |
1925 | 1961 |
1926 @override | 1962 @override |
1927 bool visitPrefix(Prefix node1, Prefix node2) { | 1963 bool visitPrefix(Prefix node1, covariant Prefix node2) { |
1928 return visitNodeList(node1, node2); | 1964 return visitNodeList(node1, node2); |
1929 } | 1965 } |
1930 | 1966 |
1931 @override | 1967 @override |
1932 bool visitRedirectingFactoryBody( | 1968 bool visitRedirectingFactoryBody( |
1933 RedirectingFactoryBody node1, RedirectingFactoryBody node2) { | 1969 RedirectingFactoryBody node1, covariant RedirectingFactoryBody node2) { |
1934 return testTokens( | 1970 return testTokens( |
1935 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && | 1971 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && |
1936 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1972 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1937 testNodes(node1, node2, 'constructorReference', | 1973 testNodes(node1, node2, 'constructorReference', |
1938 node1.constructorReference, node2.constructorReference); | 1974 node1.constructorReference, node2.constructorReference); |
1939 } | 1975 } |
1940 | 1976 |
1941 @override | 1977 @override |
1942 bool visitRethrow(Rethrow node1, Rethrow node2) { | 1978 bool visitRethrow(Rethrow node1, covariant Rethrow node2) { |
1943 return testTokens( | 1979 return testTokens( |
1944 node1, node2, 'throwToken', node1.throwToken, node2.throwToken) && | 1980 node1, node2, 'throwToken', node1.throwToken, node2.throwToken) && |
1945 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken); | 1981 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken); |
1946 } | 1982 } |
1947 | 1983 |
1948 @override | 1984 @override |
1949 bool visitReturn(Return node1, Return node2) { | 1985 bool visitReturn(Return node1, covariant Return node2) { |
1950 return testTokens( | 1986 return testTokens( |
1951 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && | 1987 node1, node2, 'beginToken', node1.beginToken, node2.beginToken) && |
1952 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 1988 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
1953 testNodes( | 1989 testNodes( |
1954 node1, node2, 'expression', node1.expression, node2.expression); | 1990 node1, node2, 'expression', node1.expression, node2.expression); |
1955 } | 1991 } |
1956 | 1992 |
1957 @override | 1993 @override |
1958 bool visitSend(Send node1, Send node2) { | 1994 bool visitSend(Send node1, covariant Send node2) { |
1959 return strategy.test(node1, node2, 'isConditional', node1.isConditional, | 1995 return strategy.test(node1, node2, 'isConditional', node1.isConditional, |
1960 node2.isConditional) && | 1996 node2.isConditional) && |
1961 testNodes(node1, node2, 'receiver', node1.receiver, node2.receiver) && | 1997 testNodes(node1, node2, 'receiver', node1.receiver, node2.receiver) && |
1962 testNodes(node1, node2, 'selector', node1.selector, node2.selector) && | 1998 testNodes(node1, node2, 'selector', node1.selector, node2.selector) && |
1963 testNodes(node1, node2, 'argumentsNode', node1.argumentsNode, | 1999 testNodes(node1, node2, 'argumentsNode', node1.argumentsNode, |
1964 node2.argumentsNode); | 2000 node2.argumentsNode); |
1965 } | 2001 } |
1966 | 2002 |
1967 @override | 2003 @override |
1968 bool visitSendSet(SendSet node1, SendSet node2) { | 2004 bool visitSendSet(SendSet node1, covariant SendSet node2) { |
1969 return visitSend(node1, node2) && | 2005 return visitSend(node1, node2) && |
1970 testNodes(node1, node2, 'assignmentOperator', node1.assignmentOperator, | 2006 testNodes(node1, node2, 'assignmentOperator', node1.assignmentOperator, |
1971 node2.assignmentOperator); | 2007 node2.assignmentOperator); |
1972 } | 2008 } |
1973 | 2009 |
1974 @override | 2010 @override |
1975 bool visitStringInterpolation( | 2011 bool visitStringInterpolation( |
1976 StringInterpolation node1, StringInterpolation node2) { | 2012 StringInterpolation node1, covariant StringInterpolation node2) { |
1977 return testNodes(node1, node2, 'string', node1.string, node2.string) && | 2013 return testNodes(node1, node2, 'string', node1.string, node2.string) && |
1978 testNodes(node1, node2, 'parts', node1.parts, node2.parts); | 2014 testNodes(node1, node2, 'parts', node1.parts, node2.parts); |
1979 } | 2015 } |
1980 | 2016 |
1981 @override | 2017 @override |
1982 bool visitStringInterpolationPart( | 2018 bool visitStringInterpolationPart( |
1983 StringInterpolationPart node1, StringInterpolationPart node2) { | 2019 StringInterpolationPart node1, covariant StringInterpolationPart node2) { |
1984 return testNodes( | 2020 return testNodes( |
1985 node1, node2, 'expression', node1.expression, node2.expression); | 2021 node1, node2, 'expression', node1.expression, node2.expression); |
1986 } | 2022 } |
1987 | 2023 |
1988 @override | 2024 @override |
1989 bool visitStringJuxtaposition( | 2025 bool visitStringJuxtaposition( |
1990 StringJuxtaposition node1, StringJuxtaposition node2) { | 2026 StringJuxtaposition node1, covariant StringJuxtaposition node2) { |
1991 return testNodes(node1, node2, 'first', node1.first, node2.first) && | 2027 return testNodes(node1, node2, 'first', node1.first, node2.first) && |
1992 testNodes(node1, node2, 'second', node1.second, node2.second); | 2028 testNodes(node1, node2, 'second', node1.second, node2.second); |
1993 } | 2029 } |
1994 | 2030 |
1995 @override | 2031 @override |
1996 bool visitSwitchCase(SwitchCase node1, SwitchCase node2) { | 2032 bool visitSwitchCase(SwitchCase node1, covariant SwitchCase node2) { |
1997 return testTokens(node1, node2, 'defaultKeyword', node1.defaultKeyword, | 2033 return testTokens(node1, node2, 'defaultKeyword', node1.defaultKeyword, |
1998 node2.defaultKeyword) && | 2034 node2.defaultKeyword) && |
1999 testTokens( | 2035 testTokens( |
2000 node1, node2, 'startToken', node1.startToken, node2.startToken) && | 2036 node1, node2, 'startToken', node1.startToken, node2.startToken) && |
2001 testNodes(node1, node2, 'labelsAndCases', node1.labelsAndCases, | 2037 testNodes(node1, node2, 'labelsAndCases', node1.labelsAndCases, |
2002 node2.labelsAndCases) && | 2038 node2.labelsAndCases) && |
2003 testNodes( | 2039 testNodes( |
2004 node1, node2, 'statements', node1.statements, node2.statements); | 2040 node1, node2, 'statements', node1.statements, node2.statements); |
2005 } | 2041 } |
2006 | 2042 |
2007 @override | 2043 @override |
2008 bool visitSwitchStatement(SwitchStatement node1, SwitchStatement node2) { | 2044 bool visitSwitchStatement( |
| 2045 SwitchStatement node1, covariant SwitchStatement node2) { |
2009 return testTokens(node1, node2, 'switchKeyword', node1.switchKeyword, | 2046 return testTokens(node1, node2, 'switchKeyword', node1.switchKeyword, |
2010 node2.switchKeyword) && | 2047 node2.switchKeyword) && |
2011 testNodes(node1, node2, 'parenthesizedExpression', | 2048 testNodes(node1, node2, 'parenthesizedExpression', |
2012 node1.parenthesizedExpression, node2.parenthesizedExpression) && | 2049 node1.parenthesizedExpression, node2.parenthesizedExpression) && |
2013 testNodes(node1, node2, 'cases', node1.cases, node2.cases); | 2050 testNodes(node1, node2, 'cases', node1.cases, node2.cases); |
2014 } | 2051 } |
2015 | 2052 |
2016 @override | 2053 @override |
2017 bool visitSyncForIn(SyncForIn node1, SyncForIn node2) { | 2054 bool visitSyncForIn(SyncForIn node1, covariant SyncForIn node2) { |
2018 return visitForIn(node1, node2); | 2055 return visitForIn(node1, node2); |
2019 } | 2056 } |
2020 | 2057 |
2021 @override | 2058 @override |
2022 bool visitThrow(Throw node1, Throw node2) { | 2059 bool visitThrow(Throw node1, covariant Throw node2) { |
2023 return testTokens( | 2060 return testTokens( |
2024 node1, node2, 'throwToken', node1.throwToken, node2.throwToken) && | 2061 node1, node2, 'throwToken', node1.throwToken, node2.throwToken) && |
2025 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 2062 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
2026 testNodes( | 2063 testNodes( |
2027 node1, node2, 'expression', node1.expression, node2.expression); | 2064 node1, node2, 'expression', node1.expression, node2.expression); |
2028 } | 2065 } |
2029 | 2066 |
2030 @override | 2067 @override |
2031 bool visitTryStatement(TryStatement node1, TryStatement node2) { | 2068 bool visitTryStatement(TryStatement node1, covariant TryStatement node2) { |
2032 return testTokens( | 2069 return testTokens( |
2033 node1, node2, 'tryKeyword', node1.tryKeyword, node2.tryKeyword) && | 2070 node1, node2, 'tryKeyword', node1.tryKeyword, node2.tryKeyword) && |
2034 testTokens(node1, node2, 'finallyKeyword', node1.finallyKeyword, | 2071 testTokens(node1, node2, 'finallyKeyword', node1.finallyKeyword, |
2035 node2.finallyKeyword) && | 2072 node2.finallyKeyword) && |
2036 testNodes(node1, node2, 'tryBlock', node1.tryBlock, node2.tryBlock) && | 2073 testNodes(node1, node2, 'tryBlock', node1.tryBlock, node2.tryBlock) && |
2037 testNodes(node1, node2, 'catchBlocks', node1.catchBlocks, | 2074 testNodes(node1, node2, 'catchBlocks', node1.catchBlocks, |
2038 node2.catchBlocks) && | 2075 node2.catchBlocks) && |
2039 testNodes(node1, node2, 'finallyBlock', node1.finallyBlock, | 2076 testNodes(node1, node2, 'finallyBlock', node1.finallyBlock, |
2040 node2.finallyBlock); | 2077 node2.finallyBlock); |
2041 } | 2078 } |
2042 | 2079 |
2043 @override | 2080 @override |
2044 bool visitNominalTypeAnnotation( | 2081 bool visitNominalTypeAnnotation( |
2045 NominalTypeAnnotation node1, NominalTypeAnnotation node2) { | 2082 NominalTypeAnnotation node1, covariant NominalTypeAnnotation node2) { |
2046 return testNodes( | 2083 return testNodes( |
2047 node1, node2, 'typeName', node1.typeName, node2.typeName) && | 2084 node1, node2, 'typeName', node1.typeName, node2.typeName) && |
2048 testNodes(node1, node2, 'typeArguments', node1.typeArguments, | 2085 testNodes(node1, node2, 'typeArguments', node1.typeArguments, |
2049 node2.typeArguments); | 2086 node2.typeArguments); |
2050 } | 2087 } |
2051 | 2088 |
2052 @override | 2089 @override |
2053 bool visitFunctionTypeAnnotation( | 2090 bool visitFunctionTypeAnnotation( |
2054 FunctionTypeAnnotation node1, FunctionTypeAnnotation node2) { | 2091 FunctionTypeAnnotation node1, covariant FunctionTypeAnnotation node2) { |
2055 return testNodes( | 2092 return testNodes( |
2056 node1, node2, 'returnType', node1.returnType, node2.returnType) && | 2093 node1, node2, 'returnType', node1.returnType, node2.returnType) && |
2057 testNodes(node1, node2, 'formals', node1.formals, node2.formals) && | 2094 testNodes(node1, node2, 'formals', node1.formals, node2.formals) && |
2058 testNodes(node1, node2, 'typeParameters', node1.typeParameters, | 2095 testNodes(node1, node2, 'typeParameters', node1.typeParameters, |
2059 node2.typeParameters); | 2096 node2.typeParameters); |
2060 } | 2097 } |
2061 | 2098 |
2062 @override | 2099 @override |
2063 bool visitTypeVariable(TypeVariable node1, TypeVariable node2) { | 2100 bool visitTypeVariable(TypeVariable node1, covariant TypeVariable node2) { |
2064 return testNodes(node1, node2, 'name', node1.name, node2.name) && | 2101 return testNodes(node1, node2, 'name', node1.name, node2.name) && |
2065 testNodes(node1, node2, 'bound', node1.bound, node2.bound); | 2102 testNodes(node1, node2, 'bound', node1.bound, node2.bound); |
2066 } | 2103 } |
2067 | 2104 |
2068 @override | 2105 @override |
2069 bool visitTypedef(Typedef node1, Typedef node2) { | 2106 bool visitTypedef(Typedef node1, covariant Typedef node2) { |
2070 return testTokens(node1, node2, 'typedefKeyword', node1.typedefKeyword, | 2107 return testTokens(node1, node2, 'typedefKeyword', node1.typedefKeyword, |
2071 node2.typedefKeyword) && | 2108 node2.typedefKeyword) && |
2072 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 2109 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
2073 testNodes( | 2110 testNodes( |
2074 node1, node2, 'returnType', node1.returnType, node2.returnType) && | 2111 node1, node2, 'returnType', node1.returnType, node2.returnType) && |
2075 testNodes(node1, node2, 'name', node1.name, node2.name) && | 2112 testNodes(node1, node2, 'name', node1.name, node2.name) && |
2076 testNodes(node1, node2, 'typeParameters', node1.templateParameters, | 2113 testNodes(node1, node2, 'typeParameters', node1.templateParameters, |
2077 node2.templateParameters) && | 2114 node2.templateParameters) && |
2078 testNodes(node1, node2, 'formals', node1.formals, node2.formals); | 2115 testNodes(node1, node2, 'formals', node1.formals, node2.formals); |
2079 } | 2116 } |
2080 | 2117 |
2081 @override | 2118 @override |
2082 bool visitVariableDefinitions( | 2119 bool visitVariableDefinitions( |
2083 VariableDefinitions node1, VariableDefinitions node2) { | 2120 VariableDefinitions node1, covariant VariableDefinitions node2) { |
2084 return testNodes( | 2121 return testNodes( |
2085 node1, node2, 'metadata', node1.metadata, node2.metadata) && | 2122 node1, node2, 'metadata', node1.metadata, node2.metadata) && |
2086 testNodes(node1, node2, 'type', node1.type, node2.type) && | 2123 testNodes(node1, node2, 'type', node1.type, node2.type) && |
2087 testNodes( | 2124 testNodes( |
2088 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && | 2125 node1, node2, 'modifiers', node1.modifiers, node2.modifiers) && |
2089 testNodes( | 2126 testNodes( |
2090 node1, node2, 'definitions', node1.definitions, node2.definitions); | 2127 node1, node2, 'definitions', node1.definitions, node2.definitions); |
2091 } | 2128 } |
2092 | 2129 |
2093 @override | 2130 @override |
2094 bool visitWhile(While node1, While node2) { | 2131 bool visitWhile(While node1, covariant While node2) { |
2095 return testTokens(node1, node2, 'whileKeyword', node1.whileKeyword, | 2132 return testTokens(node1, node2, 'whileKeyword', node1.whileKeyword, |
2096 node2.whileKeyword) && | 2133 node2.whileKeyword) && |
2097 testNodes( | 2134 testNodes( |
2098 node1, node2, 'condition', node1.condition, node2.condition) && | 2135 node1, node2, 'condition', node1.condition, node2.condition) && |
2099 testNodes(node1, node2, 'body', node1.body, node2.body); | 2136 testNodes(node1, node2, 'body', node1.body, node2.body); |
2100 } | 2137 } |
2101 | 2138 |
2102 @override | 2139 @override |
2103 bool visitYield(Yield node1, Yield node2) { | 2140 bool visitYield(Yield node1, covariant Yield node2) { |
2104 return testTokens( | 2141 return testTokens( |
2105 node1, node2, 'yieldToken', node1.yieldToken, node2.yieldToken) && | 2142 node1, node2, 'yieldToken', node1.yieldToken, node2.yieldToken) && |
2106 testTokens( | 2143 testTokens( |
2107 node1, node2, 'starToken', node1.starToken, node2.starToken) && | 2144 node1, node2, 'starToken', node1.starToken, node2.starToken) && |
2108 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && | 2145 testTokens(node1, node2, 'endToken', node1.endToken, node2.endToken) && |
2109 testNodes( | 2146 testNodes( |
2110 node1, node2, 'expression', node1.expression, node2.expression); | 2147 node1, node2, 'expression', node1.expression, node2.expression); |
2111 } | 2148 } |
2112 | 2149 |
2113 @override | 2150 @override |
2114 bool visitNode(Node node1, Node node2) { | 2151 bool visitNode(Node node1, covariant Node node2) { |
2115 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 2152 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
2116 } | 2153 } |
2117 | 2154 |
2118 @override | 2155 @override |
2119 bool visitExpression(Expression node1, Expression node2) { | 2156 bool visitExpression(Expression node1, covariant Expression node2) { |
2120 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 2157 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
2121 } | 2158 } |
2122 | 2159 |
2123 @override | 2160 @override |
2124 bool visitStatement(Statement node1, Statement node2) { | 2161 bool visitStatement(Statement node1, covariant Statement node2) { |
2125 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 2162 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
2126 } | 2163 } |
2127 | 2164 |
2128 @override | 2165 @override |
2129 bool visitStringNode(StringNode node1, StringNode node2) { | 2166 bool visitStringNode(StringNode node1, covariant StringNode node2) { |
2130 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 2167 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
2131 } | 2168 } |
2132 | 2169 |
2133 @override | 2170 @override |
2134 bool visitTypeAnnotation(TypeAnnotation node1, TypeAnnotation node2) { | 2171 bool visitTypeAnnotation( |
| 2172 TypeAnnotation node1, covariant TypeAnnotation node2) { |
2135 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); | 2173 throw new UnsupportedError('Unexpected nodes: $node1 <> $node2'); |
2136 } | 2174 } |
2137 } | 2175 } |
2138 | 2176 |
2139 bool areMetadataAnnotationsEquivalent( | 2177 bool areMetadataAnnotationsEquivalent( |
2140 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { | 2178 MetadataAnnotation metadata1, MetadataAnnotation metadata2) { |
2141 if (metadata1 == metadata2) return true; | 2179 if (metadata1 == metadata2) return true; |
2142 if (metadata1 == null || metadata2 == null) return false; | 2180 if (metadata1 == null || metadata2 == null) return false; |
2143 return areElementsEquivalent( | 2181 return areElementsEquivalent( |
2144 metadata1.annotatedElement, metadata2.annotatedElement) && | 2182 metadata1.annotatedElement, metadata2.annotatedElement) && |
2145 areConstantsEquivalent(metadata1.constant, metadata2.constant); | 2183 areConstantsEquivalent(metadata1.constant, metadata2.constant); |
2146 } | 2184 } |
OLD | NEW |