| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dart2js.send_structure; | 5 library dart2js.send_structure; |
| 6 | 6 |
| 7 import 'access_semantics.dart'; | 7 import 'access_semantics.dart'; |
| 8 import 'operators.dart'; | 8 import 'operators.dart'; |
| 9 import 'semantic_visitor.dart'; | 9 import 'semantic_visitor.dart'; |
| 10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 /// The structure for a [Send] of the form `assert(e)`. | 24 /// The structure for a [Send] of the form `assert(e)`. |
| 25 class AssertStructure<R, A> implements SendStructure<R, A> { | 25 class AssertStructure<R, A> implements SendStructure<R, A> { |
| 26 const AssertStructure(); | 26 const AssertStructure(); |
| 27 | 27 |
| 28 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 28 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 29 return visitor.visitAssert( | 29 return visitor.visitAssert( |
| 30 node, | 30 node, |
| 31 node.arguments.single, | 31 node.arguments.single, |
| 32 arg); | 32 arg); |
| 33 } | 33 } |
| 34 |
| 35 String toString() => 'assert'; |
| 34 } | 36 } |
| 35 | 37 |
| 36 /// The structure for a [Send] of the form an `assert` with less or more than | 38 /// The structure for a [Send] of the form an `assert` with less or more than |
| 37 /// one argument. | 39 /// one argument. |
| 38 class InvalidAssertStructure<R, A> implements SendStructure<R, A> { | 40 class InvalidAssertStructure<R, A> implements SendStructure<R, A> { |
| 39 const InvalidAssertStructure(); | 41 const InvalidAssertStructure(); |
| 40 | 42 |
| 41 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 43 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 42 return visitor.errorInvalidAssert( | 44 return visitor.errorInvalidAssert( |
| 43 node, | 45 node, |
| 44 node.argumentsNode, | 46 node.argumentsNode, |
| 45 arg); | 47 arg); |
| 46 } | 48 } |
| 49 |
| 50 String toString() => 'invalid assert'; |
| 47 } | 51 } |
| 48 | 52 |
| 49 /// The structure for a [Send] of the form `a && b`. | 53 /// The structure for a [Send] of the form `a && b`. |
| 50 class LogicalAndStructure<R, A> implements SendStructure<R, A> { | 54 class LogicalAndStructure<R, A> implements SendStructure<R, A> { |
| 51 const LogicalAndStructure(); | 55 const LogicalAndStructure(); |
| 52 | 56 |
| 53 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 57 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 54 return visitor.visitLogicalAnd( | 58 return visitor.visitLogicalAnd( |
| 55 node, | 59 node, |
| 56 node.receiver, | 60 node.receiver, |
| 57 node.arguments.single, | 61 node.arguments.single, |
| 58 arg); | 62 arg); |
| 59 } | 63 } |
| 64 |
| 65 String toString() => '&&'; |
| 60 } | 66 } |
| 61 | 67 |
| 62 /// The structure for a [Send] of the form `a || b`. | 68 /// The structure for a [Send] of the form `a || b`. |
| 63 class LogicalOrStructure<R, A> implements SendStructure<R, A> { | 69 class LogicalOrStructure<R, A> implements SendStructure<R, A> { |
| 64 const LogicalOrStructure(); | 70 const LogicalOrStructure(); |
| 65 | 71 |
| 66 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 72 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 67 return visitor.visitLogicalOr( | 73 return visitor.visitLogicalOr( |
| 68 node, | 74 node, |
| 69 node.receiver, | 75 node.receiver, |
| 70 node.arguments.single, | 76 node.arguments.single, |
| 71 arg); | 77 arg); |
| 72 } | 78 } |
| 79 |
| 80 String toString() => '||'; |
| 73 } | 81 } |
| 74 | 82 |
| 75 /// The structure for a [Send] of the form `a is T`. | 83 /// The structure for a [Send] of the form `a is T`. |
| 76 class IsStructure<R, A> implements SendStructure<R, A> { | 84 class IsStructure<R, A> implements SendStructure<R, A> { |
| 77 /// The type that the expression is tested against. | 85 /// The type that the expression is tested against. |
| 78 final DartType type; | 86 final DartType type; |
| 79 | 87 |
| 80 IsStructure(this.type); | 88 IsStructure(this.type); |
| 81 | 89 |
| 82 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 90 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 83 return visitor.visitIs( | 91 return visitor.visitIs( |
| 84 node, | 92 node, |
| 85 node.receiver, | 93 node.receiver, |
| 86 type, | 94 type, |
| 87 arg); | 95 arg); |
| 88 } | 96 } |
| 97 |
| 98 String toString() => 'is $type'; |
| 89 } | 99 } |
| 90 | 100 |
| 91 /// The structure for a [Send] of the form `a is! T`. | 101 /// The structure for a [Send] of the form `a is! T`. |
| 92 class IsNotStructure<R, A> implements SendStructure<R, A> { | 102 class IsNotStructure<R, A> implements SendStructure<R, A> { |
| 93 /// The type that the expression is tested against. | 103 /// The type that the expression is tested against. |
| 94 final DartType type; | 104 final DartType type; |
| 95 | 105 |
| 96 IsNotStructure(this.type); | 106 IsNotStructure(this.type); |
| 97 | 107 |
| 98 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 108 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 99 return visitor.visitIsNot( | 109 return visitor.visitIsNot( |
| 100 node, | 110 node, |
| 101 node.receiver, | 111 node.receiver, |
| 102 type, | 112 type, |
| 103 arg); | 113 arg); |
| 104 } | 114 } |
| 115 |
| 116 String toString() => 'is! $type'; |
| 105 } | 117 } |
| 106 | 118 |
| 107 /// The structure for a [Send] of the form `a as T`. | 119 /// The structure for a [Send] of the form `a as T`. |
| 108 class AsStructure<R, A> implements SendStructure<R, A> { | 120 class AsStructure<R, A> implements SendStructure<R, A> { |
| 109 /// The type that the expression is cast to. | 121 /// The type that the expression is cast to. |
| 110 final DartType type; | 122 final DartType type; |
| 111 | 123 |
| 112 AsStructure(this.type); | 124 AsStructure(this.type); |
| 113 | 125 |
| 114 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 126 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 115 return visitor.visitAs( | 127 return visitor.visitAs( |
| 116 node, | 128 node, |
| 117 node.receiver, | 129 node.receiver, |
| 118 type, | 130 type, |
| 119 arg); | 131 arg); |
| 120 } | 132 } |
| 133 |
| 134 String toString() => 'as $type'; |
| 121 } | 135 } |
| 122 | 136 |
| 123 /// The structure for a [Send] that is an invocation. | 137 /// The structure for a [Send] that is an invocation. |
| 124 class InvokeStructure<R, A> implements SendStructure<R, A> { | 138 class InvokeStructure<R, A> implements SendStructure<R, A> { |
| 125 /// The target of the invocation. | 139 /// The target of the invocation. |
| 126 final AccessSemantics semantics; | 140 final AccessSemantics semantics; |
| 127 | 141 |
| 128 /// The [Selector] for the invocation. | 142 /// The [Selector] for the invocation. |
| 129 final Selector selector; | 143 final Selector selector; |
| 130 | 144 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 semantics.element, | 324 semantics.element, |
| 311 node.argumentsNode, | 325 node.argumentsNode, |
| 312 selector, | 326 selector, |
| 313 arg); | 327 arg); |
| 314 case AccessKind.COMPOUND: | 328 case AccessKind.COMPOUND: |
| 315 // This is not a valid case. | 329 // This is not a valid case. |
| 316 break; | 330 break; |
| 317 } | 331 } |
| 318 throw new SpannableAssertionFailure(node, "Invalid invoke: ${semantics}"); | 332 throw new SpannableAssertionFailure(node, "Invalid invoke: ${semantics}"); |
| 319 } | 333 } |
| 334 |
| 335 String toString() => 'invoke($selector,$semantics)'; |
| 320 } | 336 } |
| 321 | 337 |
| 322 /// The structure for a [Send] that is a read access. | 338 /// The structure for a [Send] that is a read access. |
| 323 class GetStructure<R, A> implements SendStructure<R, A> { | 339 class GetStructure<R, A> implements SendStructure<R, A> { |
| 324 /// The target of the read access. | 340 /// The target of the read access. |
| 325 final AccessSemantics semantics; | 341 final AccessSemantics semantics; |
| 326 | 342 |
| 327 /// The [Selector] for the getter invocation. | 343 /// The [Selector] for the getter invocation. |
| 328 final Selector selector; | 344 final Selector selector; |
| 329 | 345 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 return visitor.errorUnresolvedGet( | 468 return visitor.errorUnresolvedGet( |
| 453 node, | 469 node, |
| 454 semantics.element, | 470 semantics.element, |
| 455 arg); | 471 arg); |
| 456 case AccessKind.COMPOUND: | 472 case AccessKind.COMPOUND: |
| 457 // This is not a valid case. | 473 // This is not a valid case. |
| 458 break; | 474 break; |
| 459 } | 475 } |
| 460 throw new SpannableAssertionFailure(node, "Invalid getter: ${semantics}"); | 476 throw new SpannableAssertionFailure(node, "Invalid getter: ${semantics}"); |
| 461 } | 477 } |
| 478 |
| 479 String toString() => 'get($selector,$semantics)'; |
| 462 } | 480 } |
| 463 | 481 |
| 464 /// The structure for a [Send] that is an assignment. | 482 /// The structure for a [Send] that is an assignment. |
| 465 class SetStructure<R, A> implements SendStructure<R, A> { | 483 class SetStructure<R, A> implements SendStructure<R, A> { |
| 466 /// The target of the assignment. | 484 /// The target of the assignment. |
| 467 final AccessSemantics semantics; | 485 final AccessSemantics semantics; |
| 468 | 486 |
| 469 /// The [Selector] for the setter invocation. | 487 /// The [Selector] for the setter invocation. |
| 470 final Selector selector; | 488 final Selector selector; |
| 471 | 489 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 node, | 632 node, |
| 615 semantics.element, | 633 semantics.element, |
| 616 node.arguments.single, | 634 node.arguments.single, |
| 617 arg); | 635 arg); |
| 618 case AccessKind.COMPOUND: | 636 case AccessKind.COMPOUND: |
| 619 // This is not a valid case. | 637 // This is not a valid case. |
| 620 break; | 638 break; |
| 621 } | 639 } |
| 622 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); | 640 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); |
| 623 } | 641 } |
| 642 |
| 643 String toString() => 'set($selector,$semantics)'; |
| 624 } | 644 } |
| 625 | 645 |
| 626 /// The structure for a [Send] that is a negation, i.e. of the form `!e`. | 646 /// The structure for a [Send] that is a negation, i.e. of the form `!e`. |
| 627 class NotStructure<R, A> implements SendStructure<R, A> { | 647 class NotStructure<R, A> implements SendStructure<R, A> { |
| 628 /// The target of the negation. | 648 /// The target of the negation. |
| 629 final AccessSemantics semantics; | 649 final AccessSemantics semantics; |
| 630 | 650 |
| 631 // TODO(johnniwinther): Should we store this? | 651 // TODO(johnniwinther): Should we store this? |
| 632 final Selector selector; | 652 final Selector selector; |
| 633 | 653 |
| 634 NotStructure(this.semantics, this.selector); | 654 NotStructure(this.semantics, this.selector); |
| 635 | 655 |
| 636 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 656 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 637 switch (semantics.kind) { | 657 switch (semantics.kind) { |
| 638 case AccessKind.DYNAMIC_PROPERTY: | 658 case AccessKind.DYNAMIC_PROPERTY: |
| 639 return visitor.visitNot( | 659 return visitor.visitNot( |
| 640 node, | 660 node, |
| 641 node.receiver, | 661 node.receiver, |
| 642 arg); | 662 arg); |
| 643 default: | 663 default: |
| 644 // This is not a valid case. | 664 // This is not a valid case. |
| 645 break; | 665 break; |
| 646 } | 666 } |
| 647 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); | 667 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); |
| 648 } | 668 } |
| 669 |
| 670 String toString() => 'not($selector,$semantics)'; |
| 649 } | 671 } |
| 650 | 672 |
| 651 /// The structure for a [Send] that is an invocation of a user definable unary | 673 /// The structure for a [Send] that is an invocation of a user definable unary |
| 652 /// operator. | 674 /// operator. |
| 653 class UnaryStructure<R, A> implements SendStructure<R, A> { | 675 class UnaryStructure<R, A> implements SendStructure<R, A> { |
| 654 /// The target of the unary operation. | 676 /// The target of the unary operation. |
| 655 final AccessSemantics semantics; | 677 final AccessSemantics semantics; |
| 656 | 678 |
| 657 /// The user definable unary operator. | 679 /// The user definable unary operator. |
| 658 final UnaryOperator operator; | 680 final UnaryOperator operator; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 682 node, | 704 node, |
| 683 operator, | 705 operator, |
| 684 semantics.element, | 706 semantics.element, |
| 685 arg); | 707 arg); |
| 686 default: | 708 default: |
| 687 // This is not a valid case. | 709 // This is not a valid case. |
| 688 break; | 710 break; |
| 689 } | 711 } |
| 690 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); | 712 throw new SpannableAssertionFailure(node, "Invalid setter: ${semantics}"); |
| 691 } | 713 } |
| 714 |
| 715 String toString() => 'unary($operator,$semantics)'; |
| 692 } | 716 } |
| 693 | 717 |
| 694 /// The structure for a [Send] that is an invocation of a undefined unary | 718 /// The structure for a [Send] that is an invocation of a undefined unary |
| 695 /// operator. | 719 /// operator. |
| 696 class InvalidUnaryStructure<R, A> implements SendStructure<R, A> { | 720 class InvalidUnaryStructure<R, A> implements SendStructure<R, A> { |
| 697 const InvalidUnaryStructure(); | 721 const InvalidUnaryStructure(); |
| 698 | 722 |
| 699 @override | 723 @override |
| 700 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 724 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 701 return visitor.errorUndefinedUnaryExpression( | 725 return visitor.errorUndefinedUnaryExpression( |
| 702 node, | 726 node, |
| 703 node.selector, | 727 node.selector, |
| 704 node.receiver, | 728 node.receiver, |
| 705 arg); | 729 arg); |
| 706 } | 730 } |
| 731 |
| 732 String toString() => 'invalid unary'; |
| 707 } | 733 } |
| 708 | 734 |
| 709 /// The structure for a [Send] that is an index expression, i.e. of the form | 735 /// The structure for a [Send] that is an index expression, i.e. of the form |
| 710 /// `a[b]`. | 736 /// `a[b]`. |
| 711 class IndexStructure<R, A> implements SendStructure<R, A> { | 737 class IndexStructure<R, A> implements SendStructure<R, A> { |
| 712 /// The target of the left operand. | 738 /// The target of the left operand. |
| 713 final AccessSemantics semantics; | 739 final AccessSemantics semantics; |
| 714 | 740 |
| 715 // TODO(johnniwinther): Should we store this? | 741 // TODO(johnniwinther): Should we store this? |
| 716 /// The [Selector] for the `[]` invocation. | 742 /// The [Selector] for the `[]` invocation. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 node, | 797 node, |
| 772 semantics.element, | 798 semantics.element, |
| 773 node.arguments.single, | 799 node.arguments.single, |
| 774 arg); | 800 arg); |
| 775 default: | 801 default: |
| 776 // This is not a valid case. | 802 // This is not a valid case. |
| 777 break; | 803 break; |
| 778 } | 804 } |
| 779 throw new SpannableAssertionFailure(node, "Invalid equals: ${semantics}"); | 805 throw new SpannableAssertionFailure(node, "Invalid equals: ${semantics}"); |
| 780 } | 806 } |
| 807 |
| 808 String toString() => '==($semantics)'; |
| 781 } | 809 } |
| 782 | 810 |
| 783 /// The structure for a [Send] that is a not-equals test, i.e. of the form | 811 /// The structure for a [Send] that is a not-equals test, i.e. of the form |
| 784 /// `a != b`. | 812 /// `a != b`. |
| 785 class NotEqualsStructure<R, A> implements SendStructure<R, A> { | 813 class NotEqualsStructure<R, A> implements SendStructure<R, A> { |
| 786 /// The target of the left operand. | 814 /// The target of the left operand. |
| 787 final AccessSemantics semantics; | 815 final AccessSemantics semantics; |
| 788 | 816 |
| 789 // TODO(johnniwinther): Should we store this? | 817 // TODO(johnniwinther): Should we store this? |
| 790 /// The [Selector] for the underlying `==` invocation. | 818 /// The [Selector] for the underlying `==` invocation. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 806 semantics.element, | 834 semantics.element, |
| 807 node.arguments.single, | 835 node.arguments.single, |
| 808 arg); | 836 arg); |
| 809 default: | 837 default: |
| 810 // This is not a valid case. | 838 // This is not a valid case. |
| 811 break; | 839 break; |
| 812 } | 840 } |
| 813 throw new SpannableAssertionFailure( | 841 throw new SpannableAssertionFailure( |
| 814 node, "Invalid not equals: ${semantics}"); | 842 node, "Invalid not equals: ${semantics}"); |
| 815 } | 843 } |
| 844 |
| 845 String toString() => '!=($semantics)'; |
| 816 } | 846 } |
| 817 | 847 |
| 818 /// The structure for a [Send] that is an invocation of a user-definable binary | 848 /// The structure for a [Send] that is an invocation of a user-definable binary |
| 819 /// operator. | 849 /// operator. |
| 820 class BinaryStructure<R, A> implements SendStructure<R, A> { | 850 class BinaryStructure<R, A> implements SendStructure<R, A> { |
| 821 /// The target of the left operand. | 851 /// The target of the left operand. |
| 822 final AccessSemantics semantics; | 852 final AccessSemantics semantics; |
| 823 | 853 |
| 824 /// The user definable binary operator. | 854 /// The user definable binary operator. |
| 825 final BinaryOperator operator; | 855 final BinaryOperator operator; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 853 operator, | 883 operator, |
| 854 node.arguments.single, | 884 node.arguments.single, |
| 855 arg); | 885 arg); |
| 856 default: | 886 default: |
| 857 // This is not a valid case. | 887 // This is not a valid case. |
| 858 break; | 888 break; |
| 859 } | 889 } |
| 860 throw new SpannableAssertionFailure( | 890 throw new SpannableAssertionFailure( |
| 861 node, "Invalid binary: ${semantics}"); | 891 node, "Invalid binary: ${semantics}"); |
| 862 } | 892 } |
| 893 |
| 894 String toString() => 'binary($operator,$semantics)'; |
| 863 } | 895 } |
| 864 | 896 |
| 865 /// The structure for a [Send] that is an invocation of a undefined binary | 897 /// The structure for a [Send] that is an invocation of a undefined binary |
| 866 /// operator. | 898 /// operator. |
| 867 class InvalidBinaryStructure<R, A> implements SendStructure<R, A> { | 899 class InvalidBinaryStructure<R, A> implements SendStructure<R, A> { |
| 868 const InvalidBinaryStructure(); | 900 const InvalidBinaryStructure(); |
| 869 | 901 |
| 870 @override | 902 @override |
| 871 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 903 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
| 872 return visitor.errorUndefinedBinaryExpression( | 904 return visitor.errorUndefinedBinaryExpression( |
| 873 node, | 905 node, |
| 874 node.receiver, | 906 node.receiver, |
| 875 node.selector, | 907 node.selector, |
| 876 node.arguments.single, | 908 node.arguments.single, |
| 877 arg); | 909 arg); |
| 878 } | 910 } |
| 911 |
| 912 String toString() => 'invalid binary'; |
| 879 } | 913 } |
| 880 | 914 |
| 881 /// The structure for a [Send] that is of the form `a[b] = c`. | 915 /// The structure for a [Send] that is of the form `a[b] = c`. |
| 882 class IndexSetStructure<R, A> implements SendStructure<R, A> { | 916 class IndexSetStructure<R, A> implements SendStructure<R, A> { |
| 883 /// The target of the index set operation. | 917 /// The target of the index set operation. |
| 884 final AccessSemantics semantics; | 918 final AccessSemantics semantics; |
| 885 | 919 |
| 886 // TODO(johnniwinther): Should we store this? | 920 // TODO(johnniwinther): Should we store this? |
| 887 /// The [Selector] for the `[]=` operator invocation. | 921 /// The [Selector] for the `[]=` operator invocation. |
| 888 final Selector selector; | 922 final Selector selector; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 912 node.arguments.first, | 946 node.arguments.first, |
| 913 node.arguments.tail.head, | 947 node.arguments.tail.head, |
| 914 arg); | 948 arg); |
| 915 default: | 949 default: |
| 916 // This is not a valid case. | 950 // This is not a valid case. |
| 917 break; | 951 break; |
| 918 } | 952 } |
| 919 throw new SpannableAssertionFailure( | 953 throw new SpannableAssertionFailure( |
| 920 node, "Invalid index set: ${semantics}"); | 954 node, "Invalid index set: ${semantics}"); |
| 921 } | 955 } |
| 956 |
| 957 String toString() => '[]=($semantics)'; |
| 922 } | 958 } |
| 923 | 959 |
| 924 /// The structure for a [Send] that is an prefix operation on an index | 960 /// The structure for a [Send] that is an prefix operation on an index |
| 925 /// expression, i.e. of the form `--a[b]`. | 961 /// expression, i.e. of the form `--a[b]`. |
| 926 class IndexPrefixStructure<R, A> implements SendStructure<R, A> { | 962 class IndexPrefixStructure<R, A> implements SendStructure<R, A> { |
| 927 /// The target of the left operand. | 963 /// The target of the left operand. |
| 928 final AccessSemantics semantics; | 964 final AccessSemantics semantics; |
| 929 | 965 |
| 930 /// The `++` or `--` operator used in the operation. | 966 /// The `++` or `--` operator used in the operation. |
| 931 final IncDecOperator operator; | 967 final IncDecOperator operator; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 compoundSemantics.setter, | 1304 compoundSemantics.setter, |
| 1269 operator, | 1305 operator, |
| 1270 node.arguments.single, | 1306 node.arguments.single, |
| 1271 arg); | 1307 arg); |
| 1272 } | 1308 } |
| 1273 break; | 1309 break; |
| 1274 } | 1310 } |
| 1275 throw new SpannableAssertionFailure(node, | 1311 throw new SpannableAssertionFailure(node, |
| 1276 "Invalid compound assigment: ${semantics}"); | 1312 "Invalid compound assigment: ${semantics}"); |
| 1277 } | 1313 } |
| 1314 |
| 1315 String toString() => 'compound($operator,$semantics)'; |
| 1278 } | 1316 } |
| 1279 | 1317 |
| 1280 /// The structure for a [Send] that is a compound assignment on the index | 1318 /// The structure for a [Send] that is a compound assignment on the index |
| 1281 /// operator. For instance `a[b] += c`. | 1319 /// operator. For instance `a[b] += c`. |
| 1282 class CompoundIndexSetStructure<R, A> implements SendStructure<R, A> { | 1320 class CompoundIndexSetStructure<R, A> implements SendStructure<R, A> { |
| 1283 /// The target of the index operations. | 1321 /// The target of the index operations. |
| 1284 final AccessSemantics semantics; | 1322 final AccessSemantics semantics; |
| 1285 | 1323 |
| 1286 /// The assignment operator used in the compound assignment. | 1324 /// The assignment operator used in the compound assignment. |
| 1287 final AssignmentOperator operator; | 1325 final AssignmentOperator operator; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 break; | 1369 break; |
| 1332 } | 1370 } |
| 1333 break; | 1371 break; |
| 1334 default: | 1372 default: |
| 1335 // This is not a valid case. | 1373 // This is not a valid case. |
| 1336 break; | 1374 break; |
| 1337 } | 1375 } |
| 1338 throw new SpannableAssertionFailure( | 1376 throw new SpannableAssertionFailure( |
| 1339 node, "Invalid compound index set: ${semantics}"); | 1377 node, "Invalid compound index set: ${semantics}"); |
| 1340 } | 1378 } |
| 1379 |
| 1380 String toString() => 'compound []=($operator,$semantics)'; |
| 1341 } | 1381 } |
| 1342 | 1382 |
| 1343 /// The structure for a [Send] that is a prefix operations. For instance | 1383 /// The structure for a [Send] that is a prefix operations. For instance |
| 1344 /// `++a`. | 1384 /// `++a`. |
| 1345 class PrefixStructure<R, A> implements SendStructure<R, A> { | 1385 class PrefixStructure<R, A> implements SendStructure<R, A> { |
| 1346 /// The target of the prefix operation. | 1386 /// The target of the prefix operation. |
| 1347 final AccessSemantics semantics; | 1387 final AccessSemantics semantics; |
| 1348 | 1388 |
| 1349 /// The `++` or `--` operator used in the operation. | 1389 /// The `++` or `--` operator used in the operation. |
| 1350 final IncDecOperator operator; | 1390 final IncDecOperator operator; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 node, | 1583 node, |
| 1544 compoundSemantics.getter, | 1584 compoundSemantics.getter, |
| 1545 compoundSemantics.setter, | 1585 compoundSemantics.setter, |
| 1546 operator, | 1586 operator, |
| 1547 arg); | 1587 arg); |
| 1548 } | 1588 } |
| 1549 } | 1589 } |
| 1550 throw new SpannableAssertionFailure(node, | 1590 throw new SpannableAssertionFailure(node, |
| 1551 "Invalid compound assigment: ${semantics}"); | 1591 "Invalid compound assigment: ${semantics}"); |
| 1552 } | 1592 } |
| 1593 |
| 1594 String toString() => 'prefix($operator,$semantics)'; |
| 1553 } | 1595 } |
| 1554 | 1596 |
| 1555 /// The structure for a [Send] that is a postfix operations. For instance | 1597 /// The structure for a [Send] that is a postfix operations. For instance |
| 1556 /// `a++`. | 1598 /// `a++`. |
| 1557 class PostfixStructure<R, A> implements SendStructure<R, A> { | 1599 class PostfixStructure<R, A> implements SendStructure<R, A> { |
| 1558 /// The target of the postfix operation. | 1600 /// The target of the postfix operation. |
| 1559 final AccessSemantics semantics; | 1601 final AccessSemantics semantics; |
| 1560 | 1602 |
| 1561 /// The `++` or `--` operator used in the operation. | 1603 /// The `++` or `--` operator used in the operation. |
| 1562 final IncDecOperator operator; | 1604 final IncDecOperator operator; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 node, | 1797 node, |
| 1756 compoundSemantics.getter, | 1798 compoundSemantics.getter, |
| 1757 compoundSemantics.setter, | 1799 compoundSemantics.setter, |
| 1758 operator, | 1800 operator, |
| 1759 arg); | 1801 arg); |
| 1760 } | 1802 } |
| 1761 } | 1803 } |
| 1762 throw new SpannableAssertionFailure(node, | 1804 throw new SpannableAssertionFailure(node, |
| 1763 "Invalid compound assigment: ${semantics}"); | 1805 "Invalid compound assigment: ${semantics}"); |
| 1764 } | 1806 } |
| 1807 |
| 1808 String toString() => 'postfix($operator,$semantics)'; |
| 1765 } | 1809 } |
| 1766 | 1810 |
| OLD | NEW |