Chromium Code Reviews| 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 part of dart2js.semantics_visitor; | 5 part of dart2js.semantics_visitor; |
| 6 | 6 |
| 7 /// Interface for bulk handling of a [Node] in a semantic visitor. | |
| 8 abstract class BulkHandle<R, A> { | |
| 9 /// Handle [node] either regardless of semantics or to report that [node] is | |
| 10 /// unhandled. [message] contains a message template for the latter case: | |
| 11 /// Replace '#' in [message] by `node.toString()` to create a message for the | |
| 12 /// error. | |
| 13 R bulkHandleNode(Node node, String message, A arg); | |
| 14 } | |
| 15 | |
| 7 /// Mixin that implements all `errorX` methods of [SemanticSendVisitor] by | 16 /// Mixin that implements all `errorX` methods of [SemanticSendVisitor] by |
| 8 /// delegating to a bulk handler. | 17 /// delegating to a bulk handler. |
| 9 /// | 18 /// |
| 10 /// Use this mixin to provide a trivial implementation for all `errorX` methods. | 19 /// Use this mixin to provide a trivial implementation for all `errorX` methods. |
| 11 abstract class ErrorBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 20 abstract class ErrorBulkMixin<R, A> |
| 12 R bulkHandleNode(Node node, String message, A arg); | 21 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
|
floitsch
2015/04/15 13:24:45
I would "extends BulkHandle". (same for the others
Johnni Winther
2015/04/15 14:35:40
Doesn't work; it would not be allowed as a mixin :
| |
| 13 | 22 |
| 14 R bulkHandleError(Node node, A arg) { | 23 R bulkHandleError(Node node, A arg) { |
| 15 return bulkHandleNode(node, "Error expression `$node` unhandled.", arg); | 24 return bulkHandleNode(node, "Error expression `#` unhandled.", arg); |
| 16 } | 25 } |
| 17 | 26 |
| 18 @override | 27 @override |
| 19 R errorInvalidAssert( | 28 R errorInvalidAssert( |
| 20 Send node, | 29 Send node, |
| 21 NodeList arguments, | 30 NodeList arguments, |
| 22 A arg) { | 31 A arg) { |
| 23 return bulkHandleError(node, arg); | 32 return bulkHandleError(node, arg); |
| 24 } | 33 } |
| 25 | 34 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 A arg) { | 607 A arg) { |
| 599 return bulkHandleError(node, arg); | 608 return bulkHandleError(node, arg); |
| 600 } | 609 } |
| 601 } | 610 } |
| 602 | 611 |
| 603 /// Mixin that implements all `visitXPrefix` methods of [SemanticSendVisitor] by | 612 /// Mixin that implements all `visitXPrefix` methods of [SemanticSendVisitor] by |
| 604 /// delegating to a bulk handler. | 613 /// delegating to a bulk handler. |
| 605 /// | 614 /// |
| 606 /// Use this mixin to provide a trivial implementation for all `visitXPrefix` | 615 /// Use this mixin to provide a trivial implementation for all `visitXPrefix` |
| 607 /// methods. | 616 /// methods. |
| 608 abstract class PrefixBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 617 abstract class PrefixBulkMixin<R, A> |
| 609 R bulkHandleNode(Node node, String message, A arg); | 618 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 610 | 619 |
| 611 R bulkHandlePrefix(Send node, A arg) { | 620 R bulkHandlePrefix(Send node, A arg) { |
| 612 return bulkHandleNode(node, "Prefix expression `$node` unhandled.", arg); | 621 return bulkHandleNode(node, "Prefix expression `#` unhandled.", arg); |
| 613 } | 622 } |
| 614 | 623 |
| 615 @override | 624 @override |
| 616 R visitDynamicPropertyPrefix( | 625 R visitDynamicPropertyPrefix( |
| 617 Send node, | 626 Send node, |
| 618 Node receiver, | 627 Node receiver, |
| 619 IncDecOperator operator, | 628 IncDecOperator operator, |
| 620 Selector getterSelector, | 629 Selector getterSelector, |
| 621 Selector setterSelector, | 630 Selector setterSelector, |
| 622 A arg) { | 631 A arg) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 788 A arg) { | 797 A arg) { |
| 789 return bulkHandlePrefix(node, arg); | 798 return bulkHandlePrefix(node, arg); |
| 790 } | 799 } |
| 791 } | 800 } |
| 792 | 801 |
| 793 /// Mixin that implements all `visitXPostfix` methods of [SemanticSendVisitor] | 802 /// Mixin that implements all `visitXPostfix` methods of [SemanticSendVisitor] |
| 794 /// by delegating to a bulk handler. | 803 /// by delegating to a bulk handler. |
| 795 /// | 804 /// |
| 796 /// Use this mixin to provide a trivial implementation for all `visitXPostfix` | 805 /// Use this mixin to provide a trivial implementation for all `visitXPostfix` |
| 797 /// methods. | 806 /// methods. |
| 798 abstract class PostfixBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 807 abstract class PostfixBulkMixin<R, A> |
| 799 R bulkHandleNode(Node node, String message, A arg); | 808 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 800 | 809 |
| 801 R bulkHandlePostfix(Send node, A arg) { | 810 R bulkHandlePostfix(Send node, A arg) { |
| 802 return bulkHandleNode(node, "Postfix expression `$node` unhandled.", arg); | 811 return bulkHandleNode(node, "Postfix expression `#` unhandled.", arg); |
| 803 } | 812 } |
| 804 | 813 |
| 805 @override | 814 @override |
| 806 R visitDynamicPropertyPostfix( | 815 R visitDynamicPropertyPostfix( |
| 807 Send node, | 816 Send node, |
| 808 Node receiver, | 817 Node receiver, |
| 809 IncDecOperator operator, | 818 IncDecOperator operator, |
| 810 Selector getterSelector, | 819 Selector getterSelector, |
| 811 Selector setterSelector, | 820 Selector setterSelector, |
| 812 A arg) { | 821 A arg) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 A arg) { | 987 A arg) { |
| 979 return bulkHandlePostfix(node, arg); | 988 return bulkHandlePostfix(node, arg); |
| 980 } | 989 } |
| 981 } | 990 } |
| 982 | 991 |
| 983 /// Mixin that implements all `visitXCompound` methods of [SemanticSendVisitor] | 992 /// Mixin that implements all `visitXCompound` methods of [SemanticSendVisitor] |
| 984 /// by delegating to a bulk handler. | 993 /// by delegating to a bulk handler. |
| 985 /// | 994 /// |
| 986 /// Use this mixin to provide a trivial implementation for all `xCompound` | 995 /// Use this mixin to provide a trivial implementation for all `xCompound` |
| 987 /// methods. | 996 /// methods. |
| 988 abstract class CompoundBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 997 abstract class CompoundBulkMixin<R, A> |
| 989 R bulkHandleNode(Node node, String message, A arg); | 998 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 990 | 999 |
| 991 R bulkHandleCompound(Send node, A arg) { | 1000 R bulkHandleCompound(Send node, A arg) { |
| 992 return bulkHandleNode(node, "Compound assignment `$node` unhandled.", arg); | 1001 return bulkHandleNode(node, "Compound assignment `#` unhandled.", arg); |
| 993 } | 1002 } |
| 994 | 1003 |
| 995 @override | 1004 @override |
| 996 R visitDynamicPropertyCompound( | 1005 R visitDynamicPropertyCompound( |
| 997 Send node, | 1006 Send node, |
| 998 Node receiver, | 1007 Node receiver, |
| 999 AssignmentOperator operator, | 1008 AssignmentOperator operator, |
| 1000 Node rhs, | 1009 Node rhs, |
| 1001 Selector getterSelector, | 1010 Selector getterSelector, |
| 1002 Selector setterSelector, | 1011 Selector setterSelector, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1152 A arg) { | 1161 A arg) { |
| 1153 return bulkHandleCompound(node, arg); | 1162 return bulkHandleCompound(node, arg); |
| 1154 } | 1163 } |
| 1155 } | 1164 } |
| 1156 | 1165 |
| 1157 /// Mixin that implements all `visitXInvoke` methods of [SemanticSendVisitor] by | 1166 /// Mixin that implements all `visitXInvoke` methods of [SemanticSendVisitor] by |
| 1158 /// delegating to a bulk handler. | 1167 /// delegating to a bulk handler. |
| 1159 /// | 1168 /// |
| 1160 /// Use this mixin to provide a trivial implementation for all `visitXInvoke` | 1169 /// Use this mixin to provide a trivial implementation for all `visitXInvoke` |
| 1161 /// methods. | 1170 /// methods. |
| 1162 abstract class InvokeBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1171 abstract class InvokeBulkMixin<R, A> |
| 1163 R bulkHandleNode(Node node, String message, A arg); | 1172 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1164 | 1173 |
| 1165 R bulkHandleInvoke(Send node, A arg) { | 1174 R bulkHandleInvoke(Send node, A arg) { |
| 1166 return bulkHandleNode(node, "Invocation `$node` unhandled.", arg); | 1175 return bulkHandleNode(node, "Invocation `#` unhandled.", arg); |
| 1167 } | 1176 } |
| 1168 | 1177 |
| 1169 @override | 1178 @override |
| 1170 R visitClassTypeLiteralInvoke( | 1179 R visitClassTypeLiteralInvoke( |
| 1171 Send node, | 1180 Send node, |
| 1172 ConstantExpression constant, | 1181 ConstantExpression constant, |
| 1173 NodeList arguments, | 1182 NodeList arguments, |
| 1174 CallStructure callStructure, | 1183 CallStructure callStructure, |
| 1175 A arg) { | 1184 A arg) { |
| 1176 return bulkHandleInvoke(node, arg); | 1185 return bulkHandleInvoke(node, arg); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1373 A arg) { | 1382 A arg) { |
| 1374 return bulkHandleInvoke(node, arg); | 1383 return bulkHandleInvoke(node, arg); |
| 1375 } | 1384 } |
| 1376 } | 1385 } |
| 1377 | 1386 |
| 1378 /// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by | 1387 /// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by |
| 1379 /// delegating to a bulk handler. | 1388 /// delegating to a bulk handler. |
| 1380 /// | 1389 /// |
| 1381 /// Use this mixin to provide a trivial implementation for all `visitXGet` | 1390 /// Use this mixin to provide a trivial implementation for all `visitXGet` |
| 1382 /// methods. | 1391 /// methods. |
| 1383 abstract class GetBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1392 abstract class GetBulkMixin<R, A> |
| 1384 R bulkHandleNode(Node node, String message, A arg); | 1393 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1385 | 1394 |
| 1386 R bulkHandleGet(Node node, A arg) { | 1395 R bulkHandleGet(Node node, A arg) { |
| 1387 return bulkHandleNode(node, "Read `$node` unhandled.", arg); | 1396 return bulkHandleNode(node, "Read `#` unhandled.", arg); |
| 1388 } | 1397 } |
| 1389 | 1398 |
| 1390 @override | 1399 @override |
| 1391 R visitClassTypeLiteralGet( | 1400 R visitClassTypeLiteralGet( |
| 1392 Send node, | 1401 Send node, |
| 1393 ConstantExpression constant, | 1402 ConstantExpression constant, |
| 1394 A arg) { | 1403 A arg) { |
| 1395 return bulkHandleGet(node, arg); | 1404 return bulkHandleGet(node, arg); |
| 1396 } | 1405 } |
| 1397 | 1406 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1544 A arg) { | 1553 A arg) { |
| 1545 return bulkHandleGet(node, arg); | 1554 return bulkHandleGet(node, arg); |
| 1546 } | 1555 } |
| 1547 } | 1556 } |
| 1548 | 1557 |
| 1549 /// Mixin that implements all `visitXSet` methods of [SemanticSendVisitor] by | 1558 /// Mixin that implements all `visitXSet` methods of [SemanticSendVisitor] by |
| 1550 /// delegating to a bulk handler. | 1559 /// delegating to a bulk handler. |
| 1551 /// | 1560 /// |
| 1552 /// Use this mixin to provide a trivial implementation for all `visitXSet` | 1561 /// Use this mixin to provide a trivial implementation for all `visitXSet` |
| 1553 /// methods. | 1562 /// methods. |
| 1554 abstract class SetBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1563 abstract class SetBulkMixin<R, A> |
| 1555 R bulkHandleNode(Node node, String message, A arg); | 1564 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1556 | 1565 |
| 1557 R bulkHandleSet(Send node, A arg) { | 1566 R bulkHandleSet(Send node, A arg) { |
| 1558 return bulkHandleNode(node, "Assignment `$node` unhandled.", arg); | 1567 return bulkHandleNode(node, "Assignment `#` unhandled.", arg); |
| 1559 } | 1568 } |
| 1560 | 1569 |
| 1561 @override | 1570 @override |
| 1562 R visitDynamicPropertySet( | 1571 R visitDynamicPropertySet( |
| 1563 SendSet node, | 1572 SendSet node, |
| 1564 Node receiver, | 1573 Node receiver, |
| 1565 Selector selector, | 1574 Selector selector, |
| 1566 Node rhs, | 1575 Node rhs, |
| 1567 A arg) { | 1576 A arg) { |
| 1568 return bulkHandleSet(node, arg); | 1577 return bulkHandleSet(node, arg); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1648 A arg) { | 1657 A arg) { |
| 1649 return bulkHandleSet(node, arg); | 1658 return bulkHandleSet(node, arg); |
| 1650 } | 1659 } |
| 1651 } | 1660 } |
| 1652 | 1661 |
| 1653 /// Mixin that implements all `visitXIndexSet` methods of [SemanticSendVisitor] | 1662 /// Mixin that implements all `visitXIndexSet` methods of [SemanticSendVisitor] |
| 1654 /// by delegating to a bulk handler. | 1663 /// by delegating to a bulk handler. |
| 1655 /// | 1664 /// |
| 1656 /// Use this mixin to provide a trivial implementation for all `visitXIndexSet` | 1665 /// Use this mixin to provide a trivial implementation for all `visitXIndexSet` |
| 1657 /// methods. | 1666 /// methods. |
| 1658 abstract class IndexSetBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1667 abstract class IndexSetBulkMixin<R, A> |
| 1659 R bulkHandleNode(Node node, String message, A arg); | 1668 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1660 | 1669 |
| 1661 R bulkHandleIndexSet(Send node, A arg) { | 1670 R bulkHandleIndexSet(Send node, A arg) { |
| 1662 return bulkHandleNode(node, "Index set expression `$node` unhandled.", arg); | 1671 return bulkHandleNode(node, "Index set expression `#` unhandled.", arg); |
| 1663 } | 1672 } |
| 1664 | 1673 |
| 1665 @override | 1674 @override |
| 1666 R visitCompoundIndexSet( | 1675 R visitCompoundIndexSet( |
| 1667 SendSet node, | 1676 SendSet node, |
| 1668 Node receiver, | 1677 Node receiver, |
| 1669 Node index, | 1678 Node index, |
| 1670 AssignmentOperator operator, | 1679 AssignmentOperator operator, |
| 1671 Node rhs, | 1680 Node rhs, |
| 1672 A arg) { | 1681 A arg) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1704 A arg) { | 1713 A arg) { |
| 1705 return bulkHandleIndexSet(node, arg); | 1714 return bulkHandleIndexSet(node, arg); |
| 1706 } | 1715 } |
| 1707 } | 1716 } |
| 1708 | 1717 |
| 1709 /// Mixin that implements all binary visitor methods in [SemanticSendVisitor] by | 1718 /// Mixin that implements all binary visitor methods in [SemanticSendVisitor] by |
| 1710 /// delegating to a bulk handler. | 1719 /// delegating to a bulk handler. |
| 1711 /// | 1720 /// |
| 1712 /// Use this mixin to provide a trivial implementation for all binary visitor | 1721 /// Use this mixin to provide a trivial implementation for all binary visitor |
| 1713 /// methods. | 1722 /// methods. |
| 1714 abstract class BinaryBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1723 abstract class BinaryBulkMixin<R, A> |
| 1715 R bulkHandleNode(Node node, String message, A arg); | 1724 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1716 | 1725 |
| 1717 R bulkHandleBinary(Send node, A arg) { | 1726 R bulkHandleBinary(Send node, A arg) { |
| 1718 return bulkHandleNode(node, "Binary expression `$node` unhandled.", arg); | 1727 return bulkHandleNode(node, "Binary expression `#` unhandled.", arg); |
| 1719 } | 1728 } |
| 1720 | 1729 |
| 1721 @override | 1730 @override |
| 1722 R visitBinary( | 1731 R visitBinary( |
| 1723 Send node, | 1732 Send node, |
| 1724 Node left, | 1733 Node left, |
| 1725 BinaryOperator operator, | 1734 BinaryOperator operator, |
| 1726 Node right, | 1735 Node right, |
| 1727 A arg) { | 1736 A arg) { |
| 1728 return bulkHandleBinary(node, arg); | 1737 return bulkHandleBinary(node, arg); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1791 A arg) { | 1800 A arg) { |
| 1792 return bulkHandleBinary(node, arg); | 1801 return bulkHandleBinary(node, arg); |
| 1793 } | 1802 } |
| 1794 } | 1803 } |
| 1795 | 1804 |
| 1796 /// Mixin that implements all unary visitor methods in [SemanticSendVisitor] by | 1805 /// Mixin that implements all unary visitor methods in [SemanticSendVisitor] by |
| 1797 /// delegating to a bulk handler. | 1806 /// delegating to a bulk handler. |
| 1798 /// | 1807 /// |
| 1799 /// Use this mixin to provide a trivial implementation for all unary visitor | 1808 /// Use this mixin to provide a trivial implementation for all unary visitor |
| 1800 /// methods. | 1809 /// methods. |
| 1801 abstract class UnaryBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1810 abstract class UnaryBulkMixin<R, A> |
| 1802 R bulkHandleNode(Node node, String message, A arg); | 1811 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1803 | 1812 |
| 1804 R bulkHandleUnary(Send node, A arg) { | 1813 R bulkHandleUnary(Send node, A arg) { |
| 1805 return bulkHandleNode(node, "Unary expression `$node` unhandled.", arg); | 1814 return bulkHandleNode(node, "Unary expression `#` unhandled.", arg); |
| 1806 } | 1815 } |
| 1807 | 1816 |
| 1808 @override | 1817 @override |
| 1809 R visitNot( | 1818 R visitNot( |
| 1810 Send node, | 1819 Send node, |
| 1811 Node expression, | 1820 Node expression, |
| 1812 A arg) { | 1821 A arg) { |
| 1813 return bulkHandleUnary(node, arg); | 1822 return bulkHandleUnary(node, arg); |
| 1814 } | 1823 } |
| 1815 | 1824 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1827 A arg) { | 1836 A arg) { |
| 1828 return bulkHandleUnary(node, arg); | 1837 return bulkHandleUnary(node, arg); |
| 1829 } | 1838 } |
| 1830 } | 1839 } |
| 1831 | 1840 |
| 1832 /// Mixin that implements all purely structural visitor methods in | 1841 /// Mixin that implements all purely structural visitor methods in |
| 1833 /// [SemanticSendVisitor] by delegating to a bulk handler. | 1842 /// [SemanticSendVisitor] by delegating to a bulk handler. |
| 1834 /// | 1843 /// |
| 1835 /// Use this mixin to provide a trivial implementation for all purely structural | 1844 /// Use this mixin to provide a trivial implementation for all purely structural |
| 1836 /// visitor methods. | 1845 /// visitor methods. |
| 1837 abstract class BaseBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1846 abstract class BaseBulkMixin<R, A> |
| 1838 R bulkHandleNode(Node node, String message, A arg); | 1847 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1839 | 1848 |
| 1840 @override | 1849 @override |
| 1841 R visitAs( | 1850 R visitAs( |
| 1842 Send node, | 1851 Send node, |
| 1843 Node expression, | 1852 Node expression, |
| 1844 DartType type, | 1853 DartType type, |
| 1845 A arg) { | 1854 A arg) { |
| 1846 return bulkHandleNode(node, 'As cast `$node` unhandled.', arg); | 1855 return bulkHandleNode(node, 'As cast `#` unhandled.', arg); |
| 1847 } | 1856 } |
| 1848 | 1857 |
| 1849 @override | 1858 @override |
| 1850 R visitAssert( | 1859 R visitAssert( |
| 1851 Send node, | 1860 Send node, |
| 1852 Node expression, | 1861 Node expression, |
| 1853 A arg) { | 1862 A arg) { |
| 1854 return bulkHandleNode(node, 'Assert `$node` unhandled.', arg); | 1863 return bulkHandleNode(node, 'Assert `#` unhandled.', arg); |
| 1855 } | 1864 } |
| 1856 | 1865 |
| 1857 @override | 1866 @override |
| 1858 R visitIs( | 1867 R visitIs( |
| 1859 Send node, | 1868 Send node, |
| 1860 Node expression, | 1869 Node expression, |
| 1861 DartType type, | 1870 DartType type, |
| 1862 A arg) { | 1871 A arg) { |
| 1863 return bulkHandleNode(node, 'Is test `$node` unhandled.', arg); | 1872 return bulkHandleNode(node, 'Is test `#` unhandled.', arg); |
| 1864 } | 1873 } |
| 1865 | 1874 |
| 1866 @override | 1875 @override |
| 1867 R visitIsNot( | 1876 R visitIsNot( |
| 1868 Send node, | 1877 Send node, |
| 1869 Node expression, | 1878 Node expression, |
| 1870 DartType type, | 1879 DartType type, |
| 1871 A arg) { | 1880 A arg) { |
| 1872 return bulkHandleNode(node, 'Is not test `$node` unhandled.', arg); | 1881 return bulkHandleNode(node, 'Is not test `#` unhandled.', arg); |
| 1873 } | 1882 } |
| 1874 | 1883 |
| 1875 @override | 1884 @override |
| 1876 R visitLogicalAnd( | 1885 R visitLogicalAnd( |
| 1877 Send node, | 1886 Send node, |
| 1878 Node left, | 1887 Node left, |
| 1879 Node right, | 1888 Node right, |
| 1880 A arg) { | 1889 A arg) { |
| 1881 return bulkHandleNode(node, 'Lazy and `$node` unhandled.', arg); | 1890 return bulkHandleNode(node, 'Lazy and `#` unhandled.', arg); |
| 1882 } | 1891 } |
| 1883 | 1892 |
| 1884 @override | 1893 @override |
| 1885 R visitLogicalOr( | 1894 R visitLogicalOr( |
| 1886 Send node, | 1895 Send node, |
| 1887 Node left, | 1896 Node left, |
| 1888 Node right, | 1897 Node right, |
| 1889 A arg) { | 1898 A arg) { |
| 1890 return bulkHandleNode(node, 'Lazy or `$node` unhandled.', arg); | 1899 return bulkHandleNode(node, 'Lazy or `#` unhandled.', arg); |
| 1891 } | 1900 } |
| 1892 } | 1901 } |
| 1893 | 1902 |
| 1894 /// Mixin that implements all visitor methods for `super` calls in | 1903 /// Mixin that implements all visitor methods for `super` calls in |
| 1895 /// [SemanticSendVisitor] by delegating to a bulk handler. | 1904 /// [SemanticSendVisitor] by delegating to a bulk handler. |
| 1896 /// | 1905 /// |
| 1897 /// Use this mixin to provide a trivial implementation for `super` calls | 1906 /// Use this mixin to provide a trivial implementation for `super` calls |
| 1898 /// visitor methods. | 1907 /// visitor methods. |
| 1899 abstract class SuperBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 1908 abstract class SuperBulkMixin<R, A> |
| 1900 R bulkHandleNode(Node node, String message, A arg); | 1909 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 1901 | 1910 |
| 1902 R bulkHandleSuper(Send node, A arg) { | 1911 R bulkHandleSuper(Send node, A arg) { |
| 1903 return bulkHandleNode(node, "Super call `$node` unhandled.", arg); | 1912 return bulkHandleNode(node, "Super call `#` unhandled.", arg); |
| 1904 } | 1913 } |
| 1905 | 1914 |
| 1906 @override | 1915 @override |
| 1907 R visitSuperBinary( | 1916 R visitSuperBinary( |
| 1908 Send node, | 1917 Send node, |
| 1909 FunctionElement function, | 1918 FunctionElement function, |
| 1910 BinaryOperator operator, | 1919 BinaryOperator operator, |
| 1911 Node argument, | 1920 Node argument, |
| 1912 A arg) { | 1921 A arg) { |
| 1913 return bulkHandleSuper(node, arg); | 1922 return bulkHandleSuper(node, arg); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2200 @override | 2209 @override |
| 2201 R visitSuperUnary( | 2210 R visitSuperUnary( |
| 2202 Send node, | 2211 Send node, |
| 2203 UnaryOperator operator, | 2212 UnaryOperator operator, |
| 2204 FunctionElement function, | 2213 FunctionElement function, |
| 2205 A arg) { | 2214 A arg) { |
| 2206 return bulkHandleSuper(node, arg); | 2215 return bulkHandleSuper(node, arg); |
| 2207 } | 2216 } |
| 2208 } | 2217 } |
| 2209 | 2218 |
| 2210 abstract class NewBulkMixin<R, A> implements SemanticSendVisitor<R, A> { | 2219 abstract class NewBulkMixin<R, A> |
| 2211 R bulkHandleNode(Node node, String message, A arg); | 2220 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { |
| 2212 | 2221 |
| 2213 R bulkHandleNew(NewExpression node, A arg) { | 2222 R bulkHandleNew(NewExpression node, A arg) { |
| 2214 return bulkHandleNode( | 2223 return bulkHandleNode( |
| 2215 node, "Constructor invocation `$node` unhandled.", arg); | 2224 node, "Constructor invocation `#` unhandled.", arg); |
| 2216 } | 2225 } |
| 2217 | 2226 |
| 2218 @override | 2227 @override |
| 2219 R visitConstConstructorInvoke( | 2228 R visitConstConstructorInvoke( |
| 2220 NewExpression node, | 2229 NewExpression node, |
| 2221 ConstructedConstantExpression constant, | 2230 ConstructedConstantExpression constant, |
| 2222 A arg) { | 2231 A arg) { |
| 2223 return bulkHandleNew(node, arg); | 2232 return bulkHandleNew(node, arg); |
| 2224 } | 2233 } |
| 2225 | 2234 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2295 "BulkSendVisitor.bulkHandleNode unimplemented"); | 2304 "BulkSendVisitor.bulkHandleNode unimplemented"); |
| 2296 } | 2305 } |
| 2297 } | 2306 } |
| 2298 | 2307 |
| 2299 /// Mixin that implements all `visitXParameterDecl` and | 2308 /// Mixin that implements all `visitXParameterDecl` and |
| 2300 /// `visitXInitializingFormalDecl` methods of [SemanticDeclarationVisitor] | 2309 /// `visitXInitializingFormalDecl` methods of [SemanticDeclarationVisitor] |
| 2301 /// by delegating to a bulk handler. | 2310 /// by delegating to a bulk handler. |
| 2302 /// | 2311 /// |
| 2303 /// Use this mixin to provide a trivial implementation for these methods. | 2312 /// Use this mixin to provide a trivial implementation for these methods. |
| 2304 abstract class ParameterBulkMixin<R, A> | 2313 abstract class ParameterBulkMixin<R, A> |
| 2305 implements SemanticDeclarationVisitor<R, A> { | 2314 implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> { |
| 2306 R bulkHandleNode(Node node, String message, A arg); | |
| 2307 | 2315 |
| 2308 R bulkHandleParameterDeclaration(VariableDefinitions node, A arg) { | 2316 R bulkHandleParameterDeclaration(VariableDefinitions node, A arg) { |
| 2309 return bulkHandleNode( | 2317 return bulkHandleNode( |
| 2310 node, "Parameter declaration `$node` unhandled.", arg); | 2318 node, "Parameter declaration `#` unhandled.", arg); |
| 2311 } | 2319 } |
| 2312 | 2320 |
| 2313 @override | 2321 @override |
| 2314 R visitInitializingFormalDeclaration( | 2322 R visitInitializingFormalDeclaration( |
| 2315 VariableDefinitions node, | 2323 VariableDefinitions node, |
| 2316 Node definition, | 2324 Node definition, |
| 2317 InitializingFormalElement parameter, | 2325 InitializingFormalElement parameter, |
| 2318 int index, | 2326 int index, |
| 2319 A arg) { | 2327 A arg) { |
| 2320 return bulkHandleParameterDeclaration(node, arg); | 2328 return bulkHandleParameterDeclaration(node, arg); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2371 A arg) { | 2379 A arg) { |
| 2372 return bulkHandleParameterDeclaration(node, arg); | 2380 return bulkHandleParameterDeclaration(node, arg); |
| 2373 } | 2381 } |
| 2374 } | 2382 } |
| 2375 | 2383 |
| 2376 /// Mixin that implements all `visitXConstructorDecl` methods of | 2384 /// Mixin that implements all `visitXConstructorDecl` methods of |
| 2377 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. | 2385 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. |
| 2378 /// | 2386 /// |
| 2379 /// Use this mixin to provide a trivial implementation for these methods. | 2387 /// Use this mixin to provide a trivial implementation for these methods. |
| 2380 abstract class ConstructorBulkMixin<R, A> | 2388 abstract class ConstructorBulkMixin<R, A> |
| 2381 implements SemanticDeclarationVisitor<R, A> { | 2389 implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> { |
| 2382 R bulkHandleNode(Node node, String message, A arg); | |
| 2383 | 2390 |
| 2384 R bulkHandleConstructorDeclaration(FunctionExpression node, A arg) { | 2391 R bulkHandleConstructorDeclaration(FunctionExpression node, A arg) { |
| 2385 return bulkHandleNode( | 2392 return bulkHandleNode( |
| 2386 node, "Constructor declaration `$node` unhandled.", arg); | 2393 node, "Constructor declaration `#` unhandled.", arg); |
| 2387 } | 2394 } |
| 2388 | 2395 |
| 2389 @override | 2396 @override |
| 2390 R visitFactoryConstructorDeclaration( | 2397 R visitFactoryConstructorDeclaration( |
| 2391 FunctionExpression node, | 2398 FunctionExpression node, |
| 2392 ConstructorElement constructor, | 2399 ConstructorElement constructor, |
| 2393 NodeList parameters, | 2400 NodeList parameters, |
| 2394 Node body, | 2401 Node body, |
| 2395 A arg) { | 2402 A arg) { |
| 2396 return bulkHandleConstructorDeclaration(node, arg); | 2403 return bulkHandleConstructorDeclaration(node, arg); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 2427 A arg) { | 2434 A arg) { |
| 2428 return bulkHandleConstructorDeclaration(node, arg); | 2435 return bulkHandleConstructorDeclaration(node, arg); |
| 2429 } | 2436 } |
| 2430 } | 2437 } |
| 2431 | 2438 |
| 2432 /// Mixin that implements all constructor initializer visitor methods of | 2439 /// Mixin that implements all constructor initializer visitor methods of |
| 2433 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. | 2440 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. |
| 2434 /// | 2441 /// |
| 2435 /// Use this mixin to provide a trivial implementation for these methods. | 2442 /// Use this mixin to provide a trivial implementation for these methods. |
| 2436 abstract class InitializerBulkMixin<R, A> | 2443 abstract class InitializerBulkMixin<R, A> |
| 2437 implements SemanticDeclarationVisitor<R, A> { | 2444 implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> { |
| 2438 R bulkHandleNode(Node node, String message, A arg); | |
| 2439 | 2445 |
| 2440 R bulkHandleInitializer(Send node, A arg) { | 2446 R bulkHandleInitializer(Send node, A arg) { |
| 2441 return bulkHandleNode( | 2447 return bulkHandleNode( |
| 2442 node, "Initializer `$node` unhandled.", arg); | 2448 node, "Initializer `#` unhandled.", arg); |
| 2443 } | 2449 } |
| 2444 | 2450 |
| 2445 @override | 2451 @override |
| 2446 R errorUnresolvedFieldInitializer( | 2452 R errorUnresolvedFieldInitializer( |
| 2447 SendSet node, | 2453 SendSet node, |
| 2448 Element element, | 2454 Element element, |
| 2449 Node initializer, | 2455 Node initializer, |
| 2450 A arg) { | 2456 A arg) { |
| 2451 return bulkHandleInitializer(node, arg); | 2457 return bulkHandleInitializer(node, arg); |
| 2452 } | 2458 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2500 A arg) { | 2506 A arg) { |
| 2501 return bulkHandleInitializer(node, arg); | 2507 return bulkHandleInitializer(node, arg); |
| 2502 } | 2508 } |
| 2503 } | 2509 } |
| 2504 | 2510 |
| 2505 /// Mixin that implements all function declaration visitor methods of | 2511 /// Mixin that implements all function declaration visitor methods of |
| 2506 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. | 2512 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. |
| 2507 /// | 2513 /// |
| 2508 /// Use this mixin to provide a trivial implementation for these methods. | 2514 /// Use this mixin to provide a trivial implementation for these methods. |
| 2509 abstract class FunctionBulkMixin<R, A> | 2515 abstract class FunctionBulkMixin<R, A> |
| 2510 implements SemanticDeclarationVisitor<R, A> { | 2516 implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> { |
| 2511 R bulkHandleNode(Node node, String message, A arg); | |
| 2512 | 2517 |
| 2513 R bulkHandleFunctionDeclaration(FunctionExpression node, A arg) { | 2518 R bulkHandleFunctionDeclaration(FunctionExpression node, A arg) { |
| 2514 return bulkHandleNode( | 2519 return bulkHandleNode( |
| 2515 node, "Function declaration `$node` unhandled.", arg); | 2520 node, "Function declaration `#` unhandled.", arg); |
| 2516 } | 2521 } |
| 2517 | 2522 |
| 2518 @override | 2523 @override |
| 2519 R visitAbstractGetterDeclaration( | 2524 R visitAbstractGetterDeclaration( |
| 2520 FunctionExpression node, | 2525 FunctionExpression node, |
| 2521 MethodElement getter, | 2526 MethodElement getter, |
| 2522 A arg) { | 2527 A arg) { |
| 2523 return bulkHandleFunctionDeclaration(node, arg); | 2528 return bulkHandleFunctionDeclaration(node, arg); |
| 2524 } | 2529 } |
| 2525 | 2530 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2647 A arg) { | 2652 A arg) { |
| 2648 return bulkHandleFunctionDeclaration(node, arg); | 2653 return bulkHandleFunctionDeclaration(node, arg); |
| 2649 } | 2654 } |
| 2650 } | 2655 } |
| 2651 | 2656 |
| 2652 /// Mixin that implements all variable/field declaration visitor methods of | 2657 /// Mixin that implements all variable/field declaration visitor methods of |
| 2653 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. | 2658 /// [SemanticDeclarationVisitor] by delegating to a bulk handler. |
| 2654 /// | 2659 /// |
| 2655 /// Use this mixin to provide a trivial implementation for these methods. | 2660 /// Use this mixin to provide a trivial implementation for these methods. |
| 2656 abstract class VariableBulkMixin<R, A> | 2661 abstract class VariableBulkMixin<R, A> |
| 2657 implements SemanticDeclarationVisitor<R, A> { | 2662 implements SemanticDeclarationVisitor<R, A>, BulkHandle<R, A> { |
| 2658 R bulkHandleNode(Node node, String message, A arg); | |
| 2659 | 2663 |
| 2660 R bulkHandleVariableDeclaration(VariableDefinitions node, A arg) { | 2664 R bulkHandleVariableDeclaration(VariableDefinitions node, A arg) { |
| 2661 return bulkHandleNode( | 2665 return bulkHandleNode( |
| 2662 node, "Variable declaration `$node` unhandled.", arg); | 2666 node, "Variable declaration `#` unhandled.", arg); |
| 2663 } | 2667 } |
| 2664 | 2668 |
| 2665 @override | 2669 @override |
| 2666 R visitInstanceFieldDeclaration( | 2670 R visitInstanceFieldDeclaration( |
| 2667 VariableDefinitions node, | 2671 VariableDefinitions node, |
| 2668 Node definition, | 2672 Node definition, |
| 2669 FieldElement field, | 2673 FieldElement field, |
| 2670 Node initializer, | 2674 Node initializer, |
| 2671 A arg) { | 2675 A arg) { |
| 2672 return bulkHandleVariableDeclaration(node, arg); | 2676 return bulkHandleVariableDeclaration(node, arg); |
| (...skipping 3715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6388 InterfaceType type, | 6392 InterfaceType type, |
| 6389 ConstructorElement effectiveTarget, | 6393 ConstructorElement effectiveTarget, |
| 6390 InterfaceType effectiveTargetType, | 6394 InterfaceType effectiveTargetType, |
| 6391 NodeList arguments, | 6395 NodeList arguments, |
| 6392 CallStructure callStructure, | 6396 CallStructure callStructure, |
| 6393 A arg) { | 6397 A arg) { |
| 6394 return handleConstructorInvoke( | 6398 return handleConstructorInvoke( |
| 6395 node, constructor, type, arguments, callStructure, arg); | 6399 node, constructor, type, arguments, callStructure, arg); |
| 6396 } | 6400 } |
| 6397 } | 6401 } |
| OLD | NEW |