| 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_test; | 5 part of dart2js.semantics_visitor_test; |
| 6 | 6 |
| 7 class SemanticSendTestVisitor extends SemanticTestVisitor { | 7 class SemanticSendTestVisitor extends SemanticTestVisitor { |
| 8 SemanticSendTestVisitor(TreeElements elements) : super(elements); | 8 SemanticSendTestVisitor(TreeElements elements) : super(elements); |
| 9 | 9 |
| 10 @override | 10 @override |
| 11 visitAs(Send node, Node expression, DartType type, arg) { | 11 visitAs(Send node, Node expression, ResolutionDartType type, arg) { |
| 12 visits | 12 visits |
| 13 .add(new Visit(VisitKind.VISIT_AS, expression: expression, type: type)); | 13 .add(new Visit(VisitKind.VISIT_AS, expression: expression, type: type)); |
| 14 apply(expression, arg); | 14 apply(expression, arg); |
| 15 } | 15 } |
| 16 | 16 |
| 17 @override | 17 @override |
| 18 errorInvalidCompound(Send node, ErroneousElement error, | 18 errorInvalidCompound(Send node, ErroneousElement error, |
| 19 AssignmentOperator operator, Node rhs, arg) { | 19 AssignmentOperator operator, Node rhs, arg) { |
| 20 visits.add(new Visit(VisitKind.ERROR_INVALID_COMPOUND, | 20 visits.add(new Visit(VisitKind.ERROR_INVALID_COMPOUND, |
| 21 error: error.messageKind, operator: operator, rhs: rhs)); | 21 error: error.messageKind, operator: operator, rhs: rhs)); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 @override | 251 @override |
| 252 visitExpressionInvoke(Send node, Node expression, NodeList arguments, | 252 visitExpressionInvoke(Send node, Node expression, NodeList arguments, |
| 253 CallStructure callStructure, arg) { | 253 CallStructure callStructure, arg) { |
| 254 visits.add(new Visit(VisitKind.VISIT_EXPRESSION_INVOKE, | 254 visits.add(new Visit(VisitKind.VISIT_EXPRESSION_INVOKE, |
| 255 receiver: expression, arguments: arguments)); | 255 receiver: expression, arguments: arguments)); |
| 256 } | 256 } |
| 257 | 257 |
| 258 @override | 258 @override |
| 259 visitIs(Send node, Node expression, DartType type, arg) { | 259 visitIs(Send node, Node expression, ResolutionDartType type, arg) { |
| 260 visits | 260 visits |
| 261 .add(new Visit(VisitKind.VISIT_IS, expression: expression, type: type)); | 261 .add(new Visit(VisitKind.VISIT_IS, expression: expression, type: type)); |
| 262 apply(expression, arg); | 262 apply(expression, arg); |
| 263 } | 263 } |
| 264 | 264 |
| 265 @override | 265 @override |
| 266 visitIsNot(Send node, Node expression, DartType type, arg) { | 266 visitIsNot(Send node, Node expression, ResolutionDartType type, arg) { |
| 267 visits.add( | 267 visits.add( |
| 268 new Visit(VisitKind.VISIT_IS_NOT, expression: expression, type: type)); | 268 new Visit(VisitKind.VISIT_IS_NOT, expression: expression, type: type)); |
| 269 apply(expression, arg); | 269 apply(expression, arg); |
| 270 } | 270 } |
| 271 | 271 |
| 272 @override | 272 @override |
| 273 visitLogicalAnd(Send node, Node left, Node right, arg) { | 273 visitLogicalAnd(Send node, Node left, Node right, arg) { |
| 274 visits | 274 visits |
| 275 .add(new Visit(VisitKind.VISIT_LOGICAL_AND, left: left, right: right)); | 275 .add(new Visit(VisitKind.VISIT_LOGICAL_AND, left: left, right: right)); |
| 276 apply(left, arg); | 276 apply(left, arg); |
| (...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX, | 1690 visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX, |
| 1691 getter: indexFunction, | 1691 getter: indexFunction, |
| 1692 setter: indexSetFunction, | 1692 setter: indexSetFunction, |
| 1693 index: index, | 1693 index: index, |
| 1694 operator: operator)); | 1694 operator: operator)); |
| 1695 apply(index, arg); | 1695 apply(index, arg); |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 @override | 1698 @override |
| 1699 visitUnresolvedClassConstructorInvoke(NewExpression node, Element constructor, | 1699 visitUnresolvedClassConstructorInvoke(NewExpression node, Element constructor, |
| 1700 DartType type, NodeList arguments, Selector selector, arg) { | 1700 ResolutionDartType type, NodeList arguments, Selector selector, arg) { |
| 1701 // TODO(johnniwinther): Test [type] when it is not `dynamic`. | 1701 // TODO(johnniwinther): Test [type] when it is not `dynamic`. |
| 1702 visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE, | 1702 visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE, |
| 1703 arguments: arguments)); | 1703 arguments: arguments)); |
| 1704 apply(arguments, arg); | 1704 apply(arguments, arg); |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 @override | 1707 @override |
| 1708 visitUnresolvedConstructorInvoke(NewExpression node, Element constructor, | 1708 visitUnresolvedConstructorInvoke(NewExpression node, Element constructor, |
| 1709 DartType type, NodeList arguments, Selector selector, arg) { | 1709 ResolutionDartType type, NodeList arguments, Selector selector, arg) { |
| 1710 // TODO(johnniwinther): Test [type] when it is not `dynamic`. | 1710 // TODO(johnniwinther): Test [type] when it is not `dynamic`. |
| 1711 visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE, | 1711 visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE, |
| 1712 arguments: arguments)); | 1712 arguments: arguments)); |
| 1713 apply(arguments, arg); | 1713 apply(arguments, arg); |
| 1714 } | 1714 } |
| 1715 | 1715 |
| 1716 @override | 1716 @override |
| 1717 visitConstConstructorInvoke( | 1717 visitConstConstructorInvoke( |
| 1718 NewExpression node, ConstructedConstantExpression constant, arg) { | 1718 NewExpression node, ConstructedConstantExpression constant, arg) { |
| 1719 visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE, | 1719 visits.add(new Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1742 @override | 1742 @override |
| 1743 visitStringFromEnvironmentConstructorInvoke(NewExpression node, | 1743 visitStringFromEnvironmentConstructorInvoke(NewExpression node, |
| 1744 StringFromEnvironmentConstantExpression constant, arg) { | 1744 StringFromEnvironmentConstantExpression constant, arg) { |
| 1745 visits.add(new Visit( | 1745 visits.add(new Visit( |
| 1746 VisitKind.VISIT_STRING_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, | 1746 VisitKind.VISIT_STRING_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE, |
| 1747 constant: constant.toDartText())); | 1747 constant: constant.toDartText())); |
| 1748 super.visitStringFromEnvironmentConstructorInvoke(node, constant, arg); | 1748 super.visitStringFromEnvironmentConstructorInvoke(node, constant, arg); |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 @override | 1751 @override |
| 1752 errorNonConstantConstructorInvoke(NewExpression node, Element element, | 1752 errorNonConstantConstructorInvoke( |
| 1753 DartType type, NodeList arguments, CallStructure callStructure, arg) { | 1753 NewExpression node, |
| 1754 Element element, |
| 1755 ResolutionDartType type, |
| 1756 NodeList arguments, |
| 1757 CallStructure callStructure, |
| 1758 arg) { |
| 1754 visits.add(new Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE, | 1759 visits.add(new Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE, |
| 1755 element: element, | 1760 element: element, |
| 1756 type: type, | 1761 type: type, |
| 1757 arguments: arguments, | 1762 arguments: arguments, |
| 1758 selector: callStructure)); | 1763 selector: callStructure)); |
| 1759 super.errorNonConstantConstructorInvoke( | 1764 super.errorNonConstantConstructorInvoke( |
| 1760 node, element, type, arguments, callStructure, arg); | 1765 node, element, type, arguments, callStructure, arg); |
| 1761 } | 1766 } |
| 1762 | 1767 |
| 1763 @override | 1768 @override |
| 1764 visitConstructorIncompatibleInvoke( | 1769 visitConstructorIncompatibleInvoke( |
| 1765 NewExpression node, | 1770 NewExpression node, |
| 1766 ConstructorElement constructor, | 1771 ConstructorElement constructor, |
| 1767 InterfaceType type, | 1772 ResolutionInterfaceType type, |
| 1768 NodeList arguments, | 1773 NodeList arguments, |
| 1769 CallStructure callStructure, | 1774 CallStructure callStructure, |
| 1770 arg) { | 1775 arg) { |
| 1771 visits.add(new Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE, | 1776 visits.add(new Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE, |
| 1772 element: constructor, | 1777 element: constructor, |
| 1773 type: type, | 1778 type: type, |
| 1774 arguments: arguments, | 1779 arguments: arguments, |
| 1775 selector: callStructure)); | 1780 selector: callStructure)); |
| 1776 super.visitConstructorIncompatibleInvoke( | 1781 super.visitConstructorIncompatibleInvoke( |
| 1777 node, constructor, type, arguments, callStructure, arg); | 1782 node, constructor, type, arguments, callStructure, arg); |
| 1778 } | 1783 } |
| 1779 | 1784 |
| 1780 @override | 1785 @override |
| 1781 visitFactoryConstructorInvoke( | 1786 visitFactoryConstructorInvoke( |
| 1782 NewExpression node, | 1787 NewExpression node, |
| 1783 ConstructorElement constructor, | 1788 ConstructorElement constructor, |
| 1784 InterfaceType type, | 1789 ResolutionInterfaceType type, |
| 1785 NodeList arguments, | 1790 NodeList arguments, |
| 1786 CallStructure callStructure, | 1791 CallStructure callStructure, |
| 1787 arg) { | 1792 arg) { |
| 1788 visits.add(new Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE, | 1793 visits.add(new Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE, |
| 1789 element: constructor, | 1794 element: constructor, |
| 1790 type: type, | 1795 type: type, |
| 1791 arguments: arguments, | 1796 arguments: arguments, |
| 1792 selector: callStructure)); | 1797 selector: callStructure)); |
| 1793 apply(arguments, arg); | 1798 apply(arguments, arg); |
| 1794 } | 1799 } |
| 1795 | 1800 |
| 1796 @override | 1801 @override |
| 1797 visitGenerativeConstructorInvoke( | 1802 visitGenerativeConstructorInvoke( |
| 1798 NewExpression node, | 1803 NewExpression node, |
| 1799 ConstructorElement constructor, | 1804 ConstructorElement constructor, |
| 1800 InterfaceType type, | 1805 ResolutionInterfaceType type, |
| 1801 NodeList arguments, | 1806 NodeList arguments, |
| 1802 CallStructure callStructure, | 1807 CallStructure callStructure, |
| 1803 arg) { | 1808 arg) { |
| 1804 visits.add(new Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE, | 1809 visits.add(new Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE, |
| 1805 element: constructor, | 1810 element: constructor, |
| 1806 type: type, | 1811 type: type, |
| 1807 arguments: arguments, | 1812 arguments: arguments, |
| 1808 selector: callStructure)); | 1813 selector: callStructure)); |
| 1809 apply(arguments, arg); | 1814 apply(arguments, arg); |
| 1810 } | 1815 } |
| 1811 | 1816 |
| 1812 @override | 1817 @override |
| 1813 visitRedirectingFactoryConstructorInvoke( | 1818 visitRedirectingFactoryConstructorInvoke( |
| 1814 NewExpression node, | 1819 NewExpression node, |
| 1815 ConstructorElement constructor, | 1820 ConstructorElement constructor, |
| 1816 InterfaceType type, | 1821 ResolutionInterfaceType type, |
| 1817 ConstructorElement effectiveTarget, | 1822 ConstructorElement effectiveTarget, |
| 1818 InterfaceType effectiveTargetType, | 1823 ResolutionInterfaceType effectiveTargetType, |
| 1819 NodeList arguments, | 1824 NodeList arguments, |
| 1820 CallStructure callStructure, | 1825 CallStructure callStructure, |
| 1821 arg) { | 1826 arg) { |
| 1822 visits.add(new Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, | 1827 visits.add(new Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, |
| 1823 element: constructor, | 1828 element: constructor, |
| 1824 type: type, | 1829 type: type, |
| 1825 target: effectiveTarget, | 1830 target: effectiveTarget, |
| 1826 targetType: effectiveTargetType, | 1831 targetType: effectiveTargetType, |
| 1827 arguments: arguments, | 1832 arguments: arguments, |
| 1828 selector: callStructure)); | 1833 selector: callStructure)); |
| 1829 apply(arguments, arg); | 1834 apply(arguments, arg); |
| 1830 } | 1835 } |
| 1831 | 1836 |
| 1832 @override | 1837 @override |
| 1833 visitRedirectingGenerativeConstructorInvoke( | 1838 visitRedirectingGenerativeConstructorInvoke( |
| 1834 NewExpression node, | 1839 NewExpression node, |
| 1835 ConstructorElement constructor, | 1840 ConstructorElement constructor, |
| 1836 InterfaceType type, | 1841 ResolutionInterfaceType type, |
| 1837 NodeList arguments, | 1842 NodeList arguments, |
| 1838 CallStructure callStructure, | 1843 CallStructure callStructure, |
| 1839 arg) { | 1844 arg) { |
| 1840 visits.add(new Visit( | 1845 visits.add(new Visit( |
| 1841 VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE, | 1846 VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE, |
| 1842 element: constructor, | 1847 element: constructor, |
| 1843 type: type, | 1848 type: type, |
| 1844 arguments: arguments, | 1849 arguments: arguments, |
| 1845 selector: callStructure)); | 1850 selector: callStructure)); |
| 1846 apply(arguments, arg); | 1851 apply(arguments, arg); |
| 1847 } | 1852 } |
| 1848 | 1853 |
| 1849 @override | 1854 @override |
| 1850 visitAbstractClassConstructorInvoke( | 1855 visitAbstractClassConstructorInvoke( |
| 1851 NewExpression node, | 1856 NewExpression node, |
| 1852 ConstructorElement constructor, | 1857 ConstructorElement constructor, |
| 1853 InterfaceType type, | 1858 ResolutionInterfaceType type, |
| 1854 NodeList arguments, | 1859 NodeList arguments, |
| 1855 CallStructure callStructure, | 1860 CallStructure callStructure, |
| 1856 arg) { | 1861 arg) { |
| 1857 visits.add(new Visit(VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE, | 1862 visits.add(new Visit(VisitKind.VISIT_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE, |
| 1858 element: constructor, | 1863 element: constructor, |
| 1859 type: type, | 1864 type: type, |
| 1860 arguments: arguments, | 1865 arguments: arguments, |
| 1861 selector: callStructure)); | 1866 selector: callStructure)); |
| 1862 apply(arguments, arg); | 1867 apply(arguments, arg); |
| 1863 } | 1868 } |
| 1864 | 1869 |
| 1865 @override | 1870 @override |
| 1866 visitUnresolvedRedirectingFactoryConstructorInvoke( | 1871 visitUnresolvedRedirectingFactoryConstructorInvoke( |
| 1867 NewExpression node, | 1872 NewExpression node, |
| 1868 ConstructorElement constructor, | 1873 ConstructorElement constructor, |
| 1869 InterfaceType type, | 1874 ResolutionInterfaceType type, |
| 1870 NodeList arguments, | 1875 NodeList arguments, |
| 1871 CallStructure callStructure, | 1876 CallStructure callStructure, |
| 1872 arg) { | 1877 arg) { |
| 1873 visits.add(new Visit( | 1878 visits.add(new Visit( |
| 1874 VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, | 1879 VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, |
| 1875 element: constructor, | 1880 element: constructor, |
| 1876 type: type, | 1881 type: type, |
| 1877 arguments: arguments, | 1882 arguments: arguments, |
| 1878 selector: callStructure)); | 1883 selector: callStructure)); |
| 1879 apply(arguments, arg); | 1884 apply(arguments, arg); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 } | 2490 } |
| 2486 | 2491 |
| 2487 @override | 2492 @override |
| 2488 errorInvalidIndexSetIfNull( | 2493 errorInvalidIndexSetIfNull( |
| 2489 SendSet node, ErroneousElement error, Node index, Node rhs, arg) { | 2494 SendSet node, ErroneousElement error, Node index, Node rhs, arg) { |
| 2490 visits.add( | 2495 visits.add( |
| 2491 new Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, index: index, rhs: rhs)); | 2496 new Visit(VisitKind.ERROR_INVALID_SET_IF_NULL, index: index, rhs: rhs)); |
| 2492 super.visitUnresolvedSuperIndexSetIfNull(node, error, index, rhs, arg); | 2497 super.visitUnresolvedSuperIndexSetIfNull(node, error, index, rhs, arg); |
| 2493 } | 2498 } |
| 2494 } | 2499 } |
| OLD | NEW |