OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 simple_types_inferrer; | 5 library simple_types_inferrer; |
6 | 6 |
7 import '../closure.dart' show ClosureRepresentationInfo; | 7 import '../closure.dart' show ClosureRepresentationInfo; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/names.dart' show Identifiers, Selectors; | 9 import '../common/names.dart' show Identifiers, Selectors; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (analyzedElement.isGenerativeConstructor) { | 136 if (analyzedElement.isGenerativeConstructor) { |
137 locals.fieldScope.isIndefinite = true; | 137 locals.fieldScope.isIndefinite = true; |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 DiagnosticReporter get reporter => compiler.reporter; | 141 DiagnosticReporter get reporter => compiler.reporter; |
142 | 142 |
143 ClosedWorld get closedWorld => inferrer.closedWorld; | 143 ClosedWorld get closedWorld => inferrer.closedWorld; |
144 | 144 |
145 @override | 145 @override |
146 SemanticSendVisitor get sendVisitor => this; | 146 SemanticSendVisitor<TypeInformation, dynamic> get sendVisitor => this; |
147 | 147 |
148 @override | 148 @override |
149 TypeInformation apply(ast.Node node, _) => visit(node); | 149 TypeInformation apply(ast.Node node, _) => visit(node); |
150 | 150 |
151 TypeInformation visitAssert(ast.Assert node) { | 151 TypeInformation visitAssert(ast.Assert node) { |
152 // Avoid pollution from assert statement unless enabled. | 152 // Avoid pollution from assert statement unless enabled. |
153 if (!compiler.options.enableUserAssertions) { | 153 if (!compiler.options.enableUserAssertions) { |
154 return null; | 154 return null; |
155 } | 155 } |
156 List<ast.Send> tests = <ast.Send>[]; | 156 List<ast.Send> tests = <ast.Send>[]; |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 MethodElement getter, | 1508 MethodElement getter, |
1509 MethodElement setter, | 1509 MethodElement setter, |
1510 ast.Node index, | 1510 ast.Node index, |
1511 ast.Node rhs, | 1511 ast.Node rhs, |
1512 _) { | 1512 _) { |
1513 return handleSuperCompoundIndexSet(node, getter, setter, index, rhs); | 1513 return handleSuperCompoundIndexSet(node, getter, setter, index, rhs); |
1514 } | 1514 } |
1515 | 1515 |
1516 @override | 1516 @override |
1517 TypeInformation visitUnresolvedSuperCompoundIndexSet( | 1517 TypeInformation visitUnresolvedSuperCompoundIndexSet( |
1518 ast.Send node, | 1518 ast.SendSet node, |
1519 Element element, | 1519 Element element, |
1520 ast.Node index, | 1520 ast.Node index, |
1521 op.AssignmentOperator operator, | 1521 op.AssignmentOperator operator, |
1522 ast.Node rhs, | 1522 ast.Node rhs, |
1523 _) { | 1523 _) { |
1524 return handleSuperCompoundIndexSet(node, element, element, index, rhs); | 1524 return handleSuperCompoundIndexSet(node, element, element, index, rhs); |
1525 } | 1525 } |
1526 | 1526 |
1527 @override | 1527 @override |
1528 TypeInformation visitUnresolvedSuperIndexSetIfNull( | 1528 TypeInformation visitUnresolvedSuperIndexSetIfNull( |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 @override | 1631 @override |
1632 TypeInformation visitSuperFieldCompound(ast.Send node, FieldElement field, | 1632 TypeInformation visitSuperFieldCompound(ast.Send node, FieldElement field, |
1633 op.AssignmentOperator operator, ast.Node rhs, _) { | 1633 op.AssignmentOperator operator, ast.Node rhs, _) { |
1634 return handleSuperCompound(node, field, field, rhs); | 1634 return handleSuperCompound(node, field, field, rhs); |
1635 } | 1635 } |
1636 | 1636 |
1637 @override | 1637 @override |
1638 TypeInformation visitSuperFieldSetterCompound( | 1638 TypeInformation visitSuperFieldSetterCompound( |
1639 ast.Send node, | 1639 ast.Send node, |
1640 FieldElement field, | 1640 FieldElement field, |
1641 FunctionElement setter, | 1641 SetterElement setter, |
1642 op.AssignmentOperator operator, | 1642 op.AssignmentOperator operator, |
1643 ast.Node rhs, | 1643 ast.Node rhs, |
1644 _) { | 1644 _) { |
1645 return handleSuperCompound(node, field, setter, rhs); | 1645 return handleSuperCompound(node, field, setter, rhs); |
1646 } | 1646 } |
1647 | 1647 |
1648 @override | 1648 @override |
1649 TypeInformation visitSuperGetterFieldCompound( | 1649 TypeInformation visitSuperGetterFieldCompound( |
1650 ast.Send node, | 1650 ast.Send node, |
1651 FunctionElement getter, | 1651 GetterElement getter, |
1652 FieldElement field, | 1652 FieldElement field, |
1653 op.AssignmentOperator operator, | 1653 op.AssignmentOperator operator, |
1654 ast.Node rhs, | 1654 ast.Node rhs, |
1655 _) { | 1655 _) { |
1656 return handleSuperCompound(node, getter, field, rhs); | 1656 return handleSuperCompound(node, getter, field, rhs); |
1657 } | 1657 } |
1658 | 1658 |
1659 @override | 1659 @override |
1660 TypeInformation visitSuperGetterSetterCompound( | 1660 TypeInformation visitSuperGetterSetterCompound( |
1661 ast.Send node, | 1661 ast.Send node, |
1662 FunctionElement getter, | 1662 GetterElement getter, |
1663 FunctionElement setter, | 1663 SetterElement setter, |
1664 op.AssignmentOperator operator, | 1664 op.AssignmentOperator operator, |
1665 ast.Node rhs, | 1665 ast.Node rhs, |
1666 _) { | 1666 _) { |
1667 return handleSuperCompound(node, getter, setter, rhs); | 1667 return handleSuperCompound(node, getter, setter, rhs); |
1668 } | 1668 } |
1669 | 1669 |
1670 @override | 1670 @override |
1671 TypeInformation visitSuperMethodSetterCompound( | 1671 TypeInformation visitSuperMethodSetterCompound( |
1672 ast.Send node, | 1672 ast.Send node, |
1673 FunctionElement method, | 1673 FunctionElement method, |
1674 FunctionElement setter, | 1674 SetterElement setter, |
1675 op.AssignmentOperator operator, | 1675 op.AssignmentOperator operator, |
1676 ast.Node rhs, | 1676 ast.Node rhs, |
1677 _) { | 1677 _) { |
1678 return handleSuperCompound(node, method, setter, rhs); | 1678 return handleSuperCompound(node, method, setter, rhs); |
1679 } | 1679 } |
1680 | 1680 |
1681 @override | 1681 @override |
1682 TypeInformation visitUnresolvedSuperCompound(ast.Send node, Element element, | 1682 TypeInformation visitUnresolvedSuperCompound(ast.Send node, Element element, |
1683 op.AssignmentOperator operator, ast.Node rhs, _) { | 1683 op.AssignmentOperator operator, ast.Node rhs, _) { |
1684 return handleSuperCompound(node, element, element, rhs); | 1684 return handleSuperCompound(node, element, element, rhs); |
1685 } | 1685 } |
1686 | 1686 |
1687 @override | 1687 @override |
1688 TypeInformation visitUnresolvedSuperGetterCompound( | 1688 TypeInformation visitUnresolvedSuperGetterCompound( |
1689 ast.Send node, | 1689 ast.SendSet node, |
1690 Element getter, | 1690 Element getter, |
1691 SetterElement setter, | 1691 SetterElement setter, |
1692 op.AssignmentOperator operator, | 1692 op.AssignmentOperator operator, |
1693 ast.Node rhs, | 1693 ast.Node rhs, |
1694 _) { | 1694 _) { |
1695 return handleSuperCompound(node, getter, setter, rhs); | 1695 return handleSuperCompound(node, getter, setter, rhs); |
1696 } | 1696 } |
1697 | 1697 |
1698 @override | 1698 @override |
1699 TypeInformation visitUnresolvedSuperSetterCompound( | 1699 TypeInformation visitUnresolvedSuperSetterCompound( |
(...skipping 13 matching lines...) Expand all Loading... |
1713 } | 1713 } |
1714 | 1714 |
1715 @override | 1715 @override |
1716 TypeInformation visitSuperFieldSetIfNull( | 1716 TypeInformation visitSuperFieldSetIfNull( |
1717 ast.Send node, FieldElement field, ast.Node rhs, _) { | 1717 ast.Send node, FieldElement field, ast.Node rhs, _) { |
1718 return handleSuperCompound(node, field, field, rhs); | 1718 return handleSuperCompound(node, field, field, rhs); |
1719 } | 1719 } |
1720 | 1720 |
1721 @override | 1721 @override |
1722 TypeInformation visitSuperFieldSetterSetIfNull(ast.Send node, | 1722 TypeInformation visitSuperFieldSetterSetIfNull(ast.Send node, |
1723 FieldElement field, FunctionElement setter, ast.Node rhs, _) { | 1723 FieldElement field, SetterElement setter, ast.Node rhs, _) { |
1724 return handleSuperCompound(node, field, setter, rhs); | 1724 return handleSuperCompound(node, field, setter, rhs); |
1725 } | 1725 } |
1726 | 1726 |
1727 @override | 1727 @override |
1728 TypeInformation visitSuperGetterFieldSetIfNull(ast.Send node, | 1728 TypeInformation visitSuperGetterFieldSetIfNull(ast.Send node, |
1729 FunctionElement getter, FieldElement field, ast.Node rhs, _) { | 1729 GetterElement getter, FieldElement field, ast.Node rhs, _) { |
1730 return handleSuperCompound(node, getter, field, rhs); | 1730 return handleSuperCompound(node, getter, field, rhs); |
1731 } | 1731 } |
1732 | 1732 |
1733 @override | 1733 @override |
1734 TypeInformation visitSuperGetterSetterSetIfNull(ast.Send node, | 1734 TypeInformation visitSuperGetterSetterSetIfNull(ast.Send node, |
1735 FunctionElement getter, FunctionElement setter, ast.Node rhs, _) { | 1735 GetterElement getter, SetterElement setter, ast.Node rhs, _) { |
1736 return handleSuperCompound(node, getter, setter, rhs); | 1736 return handleSuperCompound(node, getter, setter, rhs); |
1737 } | 1737 } |
1738 | 1738 |
1739 @override | 1739 @override |
1740 TypeInformation visitSuperMethodSetIfNull( | 1740 TypeInformation visitSuperMethodSetIfNull( |
1741 ast.Send node, FunctionElement method, ast.Node rhs, _) { | 1741 ast.Send node, FunctionElement method, ast.Node rhs, _) { |
1742 return handleSuperCompound(node, method, null, rhs); | 1742 return handleSuperCompound(node, method, null, rhs); |
1743 } | 1743 } |
1744 | 1744 |
1745 @override | 1745 @override |
1746 TypeInformation visitSuperMethodSetterSetIfNull(ast.Send node, | 1746 TypeInformation visitSuperMethodSetterSetIfNull(ast.Send node, |
1747 FunctionElement method, FunctionElement setter, ast.Node rhs, _) { | 1747 FunctionElement method, SetterElement setter, ast.Node rhs, _) { |
1748 return handleSuperCompound(node, method, setter, rhs); | 1748 return handleSuperCompound(node, method, setter, rhs); |
1749 } | 1749 } |
1750 | 1750 |
1751 TypeInformation handleSuperCompound( | 1751 TypeInformation handleSuperCompound( |
1752 ast.SendSet node, Element getter, Element setter, ast.Node rhs) { | 1752 ast.SendSet node, Element getter, Element setter, ast.Node rhs) { |
1753 TypeInformation rhsType = visit(rhs); | 1753 TypeInformation rhsType = visit(rhs); |
1754 return _handleSuperCompound(node, getter, setter, rhsType); | 1754 return _handleSuperCompound(node, getter, setter, rhsType); |
1755 } | 1755 } |
1756 | 1756 |
1757 @override | 1757 @override |
(...skipping 22 matching lines...) Expand all Loading... |
1780 return handleSuperPrefixPostfix(node, field, field); | 1780 return handleSuperPrefixPostfix(node, field, field); |
1781 } | 1781 } |
1782 | 1782 |
1783 @override | 1783 @override |
1784 TypeInformation visitSuperFieldPrefix( | 1784 TypeInformation visitSuperFieldPrefix( |
1785 ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) { | 1785 ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) { |
1786 return handleSuperPrefixPostfix(node, field, field); | 1786 return handleSuperPrefixPostfix(node, field, field); |
1787 } | 1787 } |
1788 | 1788 |
1789 @override | 1789 @override |
1790 TypeInformation visitSuperFieldSetterPostfix( | 1790 TypeInformation visitSuperFieldSetterPostfix(ast.SendSet node, |
1791 ast.SendSet node, | 1791 FieldElement field, SetterElement setter, op.IncDecOperator operator, _) { |
1792 FieldElement field, | |
1793 FunctionElement setter, | |
1794 op.IncDecOperator operator, | |
1795 _) { | |
1796 return handleSuperPrefixPostfix(node, field, setter); | 1792 return handleSuperPrefixPostfix(node, field, setter); |
1797 } | 1793 } |
1798 | 1794 |
1799 @override | 1795 @override |
1800 TypeInformation visitSuperFieldSetterPrefix( | 1796 TypeInformation visitSuperFieldSetterPrefix(ast.SendSet node, |
1801 ast.SendSet node, | 1797 FieldElement field, SetterElement setter, op.IncDecOperator operator, _) { |
1802 FieldElement field, | |
1803 FunctionElement setter, | |
1804 op.IncDecOperator operator, | |
1805 _) { | |
1806 return handleSuperPrefixPostfix(node, field, setter); | 1798 return handleSuperPrefixPostfix(node, field, setter); |
1807 } | 1799 } |
1808 | 1800 |
1809 @override | 1801 @override |
1810 TypeInformation visitSuperGetterFieldPostfix( | 1802 TypeInformation visitSuperGetterFieldPostfix(ast.SendSet node, |
1811 ast.SendSet node, | 1803 GetterElement getter, FieldElement field, op.IncDecOperator operator, _) { |
1812 FunctionElement getter, | |
1813 FieldElement field, | |
1814 op.IncDecOperator operator, | |
1815 _) { | |
1816 return handleSuperPrefixPostfix(node, getter, field); | 1804 return handleSuperPrefixPostfix(node, getter, field); |
1817 } | 1805 } |
1818 | 1806 |
1819 @override | 1807 @override |
1820 TypeInformation visitSuperGetterFieldPrefix( | 1808 TypeInformation visitSuperGetterFieldPrefix(ast.SendSet node, |
1821 ast.SendSet node, | 1809 GetterElement getter, FieldElement field, op.IncDecOperator operator, _) { |
1822 FunctionElement getter, | |
1823 FieldElement field, | |
1824 op.IncDecOperator operator, | |
1825 _) { | |
1826 return handleSuperPrefixPostfix(node, getter, field); | 1810 return handleSuperPrefixPostfix(node, getter, field); |
1827 } | 1811 } |
1828 | 1812 |
1829 @override | 1813 @override |
1830 TypeInformation visitSuperGetterSetterPostfix( | 1814 TypeInformation visitSuperGetterSetterPostfix( |
1831 ast.SendSet node, | 1815 ast.SendSet node, |
1832 FunctionElement getter, | 1816 GetterElement getter, |
1833 FunctionElement setter, | 1817 SetterElement setter, |
1834 op.IncDecOperator operator, | 1818 op.IncDecOperator operator, |
1835 _) { | 1819 _) { |
1836 return handleSuperPrefixPostfix(node, getter, setter); | 1820 return handleSuperPrefixPostfix(node, getter, setter); |
1837 } | 1821 } |
1838 | 1822 |
1839 @override | 1823 @override |
1840 TypeInformation visitSuperGetterSetterPrefix( | 1824 TypeInformation visitSuperGetterSetterPrefix( |
1841 ast.SendSet node, | 1825 ast.SendSet node, |
1842 FunctionElement getter, | 1826 GetterElement getter, |
1843 FunctionElement setter, | 1827 SetterElement setter, |
1844 op.IncDecOperator operator, | 1828 op.IncDecOperator operator, |
1845 _) { | 1829 _) { |
1846 return handleSuperPrefixPostfix(node, getter, setter); | 1830 return handleSuperPrefixPostfix(node, getter, setter); |
1847 } | 1831 } |
1848 | 1832 |
1849 @override | 1833 @override |
1850 TypeInformation visitSuperMethodSetterPostfix( | 1834 TypeInformation visitSuperMethodSetterPostfix( |
1851 ast.SendSet node, | 1835 ast.SendSet node, |
1852 FunctionElement method, | 1836 FunctionElement method, |
1853 FunctionElement setter, | 1837 SetterElement setter, |
1854 op.IncDecOperator operator, | 1838 op.IncDecOperator operator, |
1855 _) { | 1839 _) { |
1856 return handleSuperPrefixPostfix(node, method, setter); | 1840 return handleSuperPrefixPostfix(node, method, setter); |
1857 } | 1841 } |
1858 | 1842 |
1859 @override | 1843 @override |
1860 TypeInformation visitSuperMethodSetterPrefix( | 1844 TypeInformation visitSuperMethodSetterPrefix( |
1861 ast.SendSet node, | 1845 ast.SendSet node, |
1862 FunctionElement method, | 1846 FunctionElement method, |
1863 FunctionElement setter, | 1847 SetterElement setter, |
1864 op.IncDecOperator operator, | 1848 op.IncDecOperator operator, |
1865 _) { | 1849 _) { |
1866 return handleSuperPrefixPostfix(node, method, setter); | 1850 return handleSuperPrefixPostfix(node, method, setter); |
1867 } | 1851 } |
1868 | 1852 |
1869 @override | 1853 @override |
1870 TypeInformation visitUnresolvedSuperPrefix( | 1854 TypeInformation visitUnresolvedSuperPrefix( |
1871 ast.SendSet node, Element element, op.IncDecOperator operator, _) { | 1855 ast.SendSet node, Element element, op.IncDecOperator operator, _) { |
1872 return handleSuperPrefixPostfix(node, element, element); | 1856 return handleSuperPrefixPostfix(node, element, element); |
1873 } | 1857 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 return rhsType; | 1948 return rhsType; |
1965 } | 1949 } |
1966 | 1950 |
1967 @override | 1951 @override |
1968 TypeInformation visitSuperIndexSet(ast.SendSet node, FunctionElement function, | 1952 TypeInformation visitSuperIndexSet(ast.SendSet node, FunctionElement function, |
1969 ast.Node index, ast.Node rhs, _) { | 1953 ast.Node index, ast.Node rhs, _) { |
1970 return handleSuperIndexSet(node, function, index, rhs); | 1954 return handleSuperIndexSet(node, function, index, rhs); |
1971 } | 1955 } |
1972 | 1956 |
1973 @override | 1957 @override |
1974 TypeInformation visitUnresolvedSuperIndexSet( | 1958 TypeInformation visitUnresolvedSuperIndexSet(ast.SendSet node, |
1975 ast.SendSet node, Element element, ast.Node index, ast.Node rhs, _) { | 1959 ErroneousElement element, ast.Node index, ast.Node rhs, _) { |
1976 return handleSuperIndexSet(node, element, index, rhs); | 1960 return handleSuperIndexSet(node, element, index, rhs); |
1977 } | 1961 } |
1978 | 1962 |
1979 TypeInformation handlePlainAssignment( | 1963 TypeInformation handlePlainAssignment( |
1980 ast.Node node, | 1964 ast.Node node, |
1981 Element element, | 1965 Element element, |
1982 Selector setterSelector, | 1966 Selector setterSelector, |
1983 TypeMask setterMask, | 1967 TypeMask setterMask, |
1984 TypeInformation receiverType, | 1968 TypeInformation receiverType, |
1985 TypeInformation rhsType, | 1969 TypeInformation rhsType, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 } | 2095 } |
2112 | 2096 |
2113 @override | 2097 @override |
2114 TypeInformation visitSuperFieldSet( | 2098 TypeInformation visitSuperFieldSet( |
2115 ast.Send node, FieldElement method, ast.Node rhs, _) { | 2099 ast.Send node, FieldElement method, ast.Node rhs, _) { |
2116 return handleSuperSet(node, method, rhs); | 2100 return handleSuperSet(node, method, rhs); |
2117 } | 2101 } |
2118 | 2102 |
2119 @override | 2103 @override |
2120 TypeInformation visitSuperSetterSet( | 2104 TypeInformation visitSuperSetterSet( |
2121 ast.Send node, SetterElement field, ast.Node rhs, _) { | 2105 ast.SendSet node, SetterElement field, ast.Node rhs, _) { |
2122 return handleSuperSet(node, field, rhs); | 2106 return handleSuperSet(node, field, rhs); |
2123 } | 2107 } |
2124 | 2108 |
2125 @override | 2109 @override |
2126 TypeInformation visitUnresolvedSuperIndex( | 2110 TypeInformation visitUnresolvedSuperIndex( |
2127 ast.Send node, Element element, ast.Node index, _) { | 2111 ast.Send node, Element element, ast.Node index, _) { |
2128 return handleErroneousSuperSend(node); | 2112 return handleErroneousSuperSend(node); |
2129 } | 2113 } |
2130 | 2114 |
2131 @override | 2115 @override |
(...skipping 13 matching lines...) Expand all Loading... |
2145 return handleErroneousSuperSend(node); | 2129 return handleErroneousSuperSend(node); |
2146 } | 2130 } |
2147 | 2131 |
2148 @override | 2132 @override |
2149 TypeInformation visitSuperSetterGet(ast.Send node, MethodElement setter, _) { | 2133 TypeInformation visitSuperSetterGet(ast.Send node, MethodElement setter, _) { |
2150 return handleErroneousSuperSend(node); | 2134 return handleErroneousSuperSend(node); |
2151 } | 2135 } |
2152 | 2136 |
2153 @override | 2137 @override |
2154 TypeInformation visitSuperGetterSet( | 2138 TypeInformation visitSuperGetterSet( |
2155 ast.Send node, MethodElement getter, ast.Node rhs, _) { | 2139 ast.Send node, GetterElement getter, ast.Node rhs, _) { |
2156 return handleErroneousSuperSend(node); | 2140 return handleErroneousSuperSend(node); |
2157 } | 2141 } |
2158 | 2142 |
2159 @override | 2143 @override |
2160 TypeInformation visitSuperMethodSet( | 2144 TypeInformation visitSuperMethodSet( |
2161 ast.Send node, MethodElement method, ast.Node rhs, _) { | 2145 ast.SendSet node, MethodElement method, ast.Node rhs, _) { |
2162 return handleErroneousSuperSend(node); | 2146 return handleErroneousSuperSend(node); |
2163 } | 2147 } |
2164 | 2148 |
2165 @override | 2149 @override |
2166 TypeInformation visitFinalSuperFieldSet( | 2150 TypeInformation visitFinalSuperFieldSet( |
2167 ast.Send node, FieldElement method, ast.Node rhs, _) { | 2151 ast.Send node, FieldElement method, ast.Node rhs, _) { |
2168 return handleErroneousSuperSend(node); | 2152 return handleErroneousSuperSend(node); |
2169 } | 2153 } |
2170 | 2154 |
2171 @override | 2155 @override |
(...skipping 23 matching lines...) Expand all Loading... |
2195 return handleSuperGet(node, method); | 2179 return handleSuperGet(node, method); |
2196 } | 2180 } |
2197 | 2181 |
2198 @override | 2182 @override |
2199 TypeInformation visitSuperFieldInvoke(ast.Send node, FieldElement field, | 2183 TypeInformation visitSuperFieldInvoke(ast.Send node, FieldElement field, |
2200 ast.NodeList arguments, CallStructure callStructure, _) { | 2184 ast.NodeList arguments, CallStructure callStructure, _) { |
2201 return handleSuperClosureCall(node, field, arguments); | 2185 return handleSuperClosureCall(node, field, arguments); |
2202 } | 2186 } |
2203 | 2187 |
2204 @override | 2188 @override |
2205 TypeInformation visitSuperGetterInvoke(ast.Send node, MethodElement getter, | 2189 TypeInformation visitSuperGetterInvoke(ast.Send node, GetterElement getter, |
2206 ast.NodeList arguments, CallStructure callStructure, _) { | 2190 ast.NodeList arguments, CallStructure callStructure, _) { |
2207 return handleSuperClosureCall(node, getter, arguments); | 2191 return handleSuperClosureCall(node, getter, arguments); |
2208 } | 2192 } |
2209 | 2193 |
2210 @override | 2194 @override |
2211 TypeInformation visitSuperMethodInvoke(ast.Send node, MethodElement method, | 2195 TypeInformation visitSuperMethodInvoke(ast.Send node, MethodElement method, |
2212 ast.NodeList arguments, CallStructure callStructure, _) { | 2196 ast.NodeList arguments, CallStructure callStructure, _) { |
2213 return handleSuperMethodInvoke( | 2197 return handleSuperMethodInvoke( |
2214 node, method, analyzeArguments(arguments.nodes)); | 2198 node, method, analyzeArguments(arguments.nodes)); |
2215 } | 2199 } |
2216 | 2200 |
2217 @override | 2201 @override |
2218 TypeInformation visitSuperSetterInvoke(ast.Send node, FunctionElement setter, | 2202 TypeInformation visitSuperSetterInvoke(ast.Send node, SetterElement setter, |
2219 ast.NodeList arguments, CallStructure callStructure, _) { | 2203 ast.NodeList arguments, CallStructure callStructure, _) { |
2220 return handleErroneousSuperSend(node); | 2204 return handleErroneousSuperSend(node); |
2221 } | 2205 } |
2222 | 2206 |
2223 @override | 2207 @override |
2224 TypeInformation visitSuperIndex( | 2208 TypeInformation visitSuperIndex( |
2225 ast.Send node, MethodElement method, ast.Node index, _) { | 2209 ast.Send node, MethodElement method, ast.Node index, _) { |
2226 return handleSuperMethodInvoke( | 2210 return handleSuperMethodInvoke( |
2227 node, method, analyzeArguments(node.arguments)); | 2211 node, method, analyzeArguments(node.arguments)); |
2228 } | 2212 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 TypeInformation visitStaticFunctionIncompatibleInvoke( | 2437 TypeInformation visitStaticFunctionIncompatibleInvoke( |
2454 ast.Send node, | 2438 ast.Send node, |
2455 MethodElement function, | 2439 MethodElement function, |
2456 ast.NodeList arguments, | 2440 ast.NodeList arguments, |
2457 CallStructure callStructure, | 2441 CallStructure callStructure, |
2458 _) { | 2442 _) { |
2459 return handleInvalidStaticInvoke(node); | 2443 return handleInvalidStaticInvoke(node); |
2460 } | 2444 } |
2461 | 2445 |
2462 @override | 2446 @override |
2463 TypeInformation visitStaticGetterInvoke(ast.Send node, FunctionElement getter, | 2447 TypeInformation visitStaticGetterInvoke(ast.Send node, GetterElement getter, |
2464 ast.NodeList arguments, CallStructure callStructure, _) { | 2448 ast.NodeList arguments, CallStructure callStructure, _) { |
2465 return handleStaticFieldOrGetterInvoke(node, getter); | 2449 return handleStaticFieldOrGetterInvoke(node, getter); |
2466 } | 2450 } |
2467 | 2451 |
2468 @override | 2452 @override |
2469 TypeInformation visitTopLevelFieldInvoke(ast.Send node, FieldElement field, | 2453 TypeInformation visitTopLevelFieldInvoke(ast.Send node, FieldElement field, |
2470 ast.NodeList arguments, CallStructure callStructure, _) { | 2454 ast.NodeList arguments, CallStructure callStructure, _) { |
2471 return handleStaticFieldOrGetterInvoke(node, field); | 2455 return handleStaticFieldOrGetterInvoke(node, field); |
2472 } | 2456 } |
2473 | 2457 |
(...skipping 11 matching lines...) Expand all Loading... |
2485 TypeInformation visitTopLevelFunctionIncompatibleInvoke( | 2469 TypeInformation visitTopLevelFunctionIncompatibleInvoke( |
2486 ast.Send node, | 2470 ast.Send node, |
2487 MethodElement function, | 2471 MethodElement function, |
2488 ast.NodeList arguments, | 2472 ast.NodeList arguments, |
2489 CallStructure callStructure, | 2473 CallStructure callStructure, |
2490 _) { | 2474 _) { |
2491 return handleInvalidStaticInvoke(node); | 2475 return handleInvalidStaticInvoke(node); |
2492 } | 2476 } |
2493 | 2477 |
2494 @override | 2478 @override |
2495 TypeInformation visitTopLevelGetterInvoke( | 2479 TypeInformation visitTopLevelGetterInvoke(ast.Send node, GetterElement getter, |
2496 ast.Send node, | 2480 ast.NodeList arguments, CallStructure callStructure, _) { |
2497 FunctionElement getter, | |
2498 ast.NodeList arguments, | |
2499 CallStructure callStructure, | |
2500 _) { | |
2501 return handleStaticFieldOrGetterInvoke(node, getter); | 2481 return handleStaticFieldOrGetterInvoke(node, getter); |
2502 } | 2482 } |
2503 | 2483 |
2504 @override | 2484 @override |
2505 TypeInformation visitStaticSetterInvoke(ast.Send node, MethodElement setter, | 2485 TypeInformation visitStaticSetterInvoke(ast.Send node, MethodElement setter, |
2506 ast.NodeList arguments, CallStructure callStructure, _) { | 2486 ast.NodeList arguments, CallStructure callStructure, _) { |
2507 return handleInvalidStaticInvoke(node); | 2487 return handleInvalidStaticInvoke(node); |
2508 } | 2488 } |
2509 | 2489 |
2510 @override | 2490 @override |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 } | 2545 } |
2566 | 2546 |
2567 /// Read a static or top level field. | 2547 /// Read a static or top level field. |
2568 TypeInformation handleStaticFieldGet(ast.Send node, FieldElement field) { | 2548 TypeInformation handleStaticFieldGet(ast.Send node, FieldElement field) { |
2569 Selector selector = elements.getSelector(node); | 2549 Selector selector = elements.getSelector(node); |
2570 TypeMask mask = inTreeData.typeOfSend(node); | 2550 TypeMask mask = inTreeData.typeOfSend(node); |
2571 return handleStaticSend(node, selector, mask, field, null); | 2551 return handleStaticSend(node, selector, mask, field, null); |
2572 } | 2552 } |
2573 | 2553 |
2574 /// Invoke a static or top level getter. | 2554 /// Invoke a static or top level getter. |
2575 TypeInformation handleStaticGetterGet(ast.Send node, MethodElement getter) { | 2555 TypeInformation handleStaticGetterGet(ast.Send node, GetterElement getter) { |
2576 Selector selector = elements.getSelector(node); | 2556 Selector selector = elements.getSelector(node); |
2577 TypeMask mask = inTreeData.typeOfSend(node); | 2557 TypeMask mask = inTreeData.typeOfSend(node); |
2578 return handleStaticSend(node, selector, mask, getter, null); | 2558 return handleStaticSend(node, selector, mask, getter, null); |
2579 } | 2559 } |
2580 | 2560 |
2581 /// Closurize a static or top level function. | 2561 /// Closurize a static or top level function. |
2582 TypeInformation handleStaticFunctionGet( | 2562 TypeInformation handleStaticFunctionGet( |
2583 ast.Send node, MethodElement function) { | 2563 ast.Send node, MethodElement function) { |
2584 Selector selector = elements.getSelector(node); | 2564 Selector selector = elements.getSelector(node); |
2585 TypeMask mask = inTreeData.typeOfSend(node); | 2565 TypeMask mask = inTreeData.typeOfSend(node); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 return handleStaticFieldGet(node, field); | 2601 return handleStaticFieldGet(node, field); |
2622 } | 2602 } |
2623 | 2603 |
2624 @override | 2604 @override |
2625 TypeInformation visitStaticFunctionGet( | 2605 TypeInformation visitStaticFunctionGet( |
2626 ast.Send node, MethodElement function, _) { | 2606 ast.Send node, MethodElement function, _) { |
2627 return handleStaticFunctionGet(node, function); | 2607 return handleStaticFunctionGet(node, function); |
2628 } | 2608 } |
2629 | 2609 |
2630 @override | 2610 @override |
2631 TypeInformation visitStaticGetterGet( | 2611 TypeInformation visitStaticGetterGet(ast.Send node, GetterElement getter, _) { |
2632 ast.Send node, FunctionElement getter, _) { | |
2633 return handleStaticGetterGet(node, getter); | 2612 return handleStaticGetterGet(node, getter); |
2634 } | 2613 } |
2635 | 2614 |
2636 @override | 2615 @override |
2637 TypeInformation visitThisPropertyGet(ast.Send node, Name name, _) { | 2616 TypeInformation visitThisPropertyGet(ast.Send node, Name name, _) { |
2638 return handleDynamicGet(node); | 2617 return handleDynamicGet(node); |
2639 } | 2618 } |
2640 | 2619 |
2641 @override | 2620 @override |
2642 TypeInformation visitTopLevelFieldGet(ast.Send node, FieldElement field, _) { | 2621 TypeInformation visitTopLevelFieldGet(ast.Send node, FieldElement field, _) { |
2643 return handleStaticFieldGet(node, field); | 2622 return handleStaticFieldGet(node, field); |
2644 } | 2623 } |
2645 | 2624 |
2646 @override | 2625 @override |
2647 TypeInformation visitTopLevelFunctionGet( | 2626 TypeInformation visitTopLevelFunctionGet( |
2648 ast.Send node, MethodElement function, _) { | 2627 ast.Send node, MethodElement function, _) { |
2649 return handleStaticFunctionGet(node, function); | 2628 return handleStaticFunctionGet(node, function); |
2650 } | 2629 } |
2651 | 2630 |
2652 @override | 2631 @override |
2653 TypeInformation visitTopLevelGetterGet( | 2632 TypeInformation visitTopLevelGetterGet( |
2654 ast.Send node, FunctionElement getter, _) { | 2633 ast.Send node, GetterElement getter, _) { |
2655 return handleStaticGetterGet(node, getter); | 2634 return handleStaticGetterGet(node, getter); |
2656 } | 2635 } |
2657 | 2636 |
2658 @override | 2637 @override |
2659 TypeInformation visitStaticSetterGet(ast.Send node, MethodElement setter, _) { | 2638 TypeInformation visitStaticSetterGet(ast.Send node, MethodElement setter, _) { |
2660 return types.dynamicType; | 2639 return types.dynamicType; |
2661 } | 2640 } |
2662 | 2641 |
2663 @override | 2642 @override |
2664 TypeInformation visitTopLevelSetterGet( | 2643 TypeInformation visitTopLevelSetterGet( |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2957 Selector moveNextSelector = Selectors.moveNext; | 2936 Selector moveNextSelector = Selectors.moveNext; |
2958 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); | 2937 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); |
2959 | 2938 |
2960 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2939 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
2961 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2940 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
2962 | 2941 |
2963 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2942 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
2964 moveNextSelector, moveNextMask); | 2943 moveNextSelector, moveNextMask); |
2965 } | 2944 } |
2966 } | 2945 } |
OLD | NEW |