Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: tests/compiler/dart2js/semantic_visitor_test_send_data.dart

Issue 1262363003: Handle super index SendSet operations. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 const Map<String, List<Test>> SEND_TESTS = const { 7 const Map<String, List<Test>> SEND_TESTS = const {
8 'Parameters': const [ 8 'Parameters': const [
9 // Parameters 9 // Parameters
10 const Test('m(o) => o;', 10 const Test('m(o) => o;',
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 m() => 2 === 3; 1723 m() => 2 === 3;
1724 ''', 1724 ''',
1725 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, 1725 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION,
1726 left: '2', operator: '===', right: '3')), 1726 left: '2', operator: '===', right: '3')),
1727 const Test( 1727 const Test(
1728 ''' 1728 '''
1729 m() => 2 !== 3; 1729 m() => 2 !== 3;
1730 ''', 1730 ''',
1731 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION, 1731 const Visit(VisitKind.ERROR_UNDEFINED_BINARY_EXPRESSION,
1732 left: '2', operator: '!==', right: '3')), 1732 left: '2', operator: '!==', right: '3')),
1733 const Test.clazz(
1734 '''
1735 class B {
1736 operator +(_) => null;
1737 }
1738 class C extends B {
1739 static m() => super + 42;
1740 }
1741 ''',
1742 const Visit(VisitKind.ERROR_INVALID_BINARY,
1743 error: MessageKind.NO_SUPER_IN_STATIC,
1744 operator: '+',
1745 right: '42')),
1733 ], 1746 ],
1734 'Index': const [ 1747 'Index': const [
1735 // Index 1748 // Index
1736 const Test( 1749 const Test(
1737 ''' 1750 '''
1738 m() => 2[3]; 1751 m() => 2[3];
1739 ''', 1752 ''',
1740 const Visit(VisitKind.VISIT_INDEX, 1753 const Visit(VisitKind.VISIT_INDEX,
1741 receiver: '2', index: '3')), 1754 receiver: '2', index: '3')),
1742 const Test( 1755 const Test(
(...skipping 27 matching lines...) Expand all
1770 class C extends B { 1783 class C extends B {
1771 m() => super[42]; 1784 m() => super[42];
1772 } 1785 }
1773 ''', 1786 ''',
1774 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX, 1787 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX,
1775 index: '42')), 1788 index: '42')),
1776 const Test.clazz( 1789 const Test.clazz(
1777 ''' 1790 '''
1778 class B { 1791 class B {
1779 operator [](_) => null; 1792 operator [](_) => null;
1793 }
1794 class C extends B {
1795 static m() => super[42];
1796 }
1797 ''',
1798 const Visit(VisitKind.ERROR_INVALID_INDEX,
1799 error: MessageKind.NO_SUPER_IN_STATIC,
1800 index: '42')),
1801 const Test.clazz(
1802 '''
1803 class B {
1804 operator [](_) => null;
1780 operator []=(a, b) {} 1805 operator []=(a, b) {}
1781 } 1806 }
1782 class C extends B { 1807 class C extends B {
1783 m() => ++super[42]; 1808 m() => ++super[42];
1784 } 1809 }
1785 ''', 1810 ''',
1786 const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX, 1811 const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,
1787 getter: 'function(B#[])', 1812 getter: 'function(B#[])',
1788 setter: 'function(B#[]=)', 1813 setter: 'function(B#[]=)',
1789 index: '42', 1814 index: '42',
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 getter: 'function(B#[])', 1850 getter: 'function(B#[])',
1826 index: '42', 1851 index: '42',
1827 operator: '++')), 1852 operator: '++')),
1828 const Test.clazz( 1853 const Test.clazz(
1829 ''' 1854 '''
1830 class B { 1855 class B {
1831 operator [](_) => null; 1856 operator [](_) => null;
1832 operator []=(a, b) {} 1857 operator []=(a, b) {}
1833 } 1858 }
1834 class C extends B { 1859 class C extends B {
1860 static m() => ++super[42];
1861 }
1862 ''',
1863 const Visit(VisitKind.ERROR_INVALID_INDEX_PREFIX,
1864 error: MessageKind.NO_SUPER_IN_STATIC,
1865 index: '42',
1866 operator: '++')),
1867 const Test.clazz(
1868 '''
1869 class B {
1870 operator [](_) => null;
1871 operator []=(a, b) {}
1872 }
1873 class C extends B {
1835 m() => super[42]--; 1874 m() => super[42]--;
1836 } 1875 }
1837 ''', 1876 ''',
1838 const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX, 1877 const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,
1839 getter: 'function(B#[])', 1878 getter: 'function(B#[])',
1840 setter: 'function(B#[]=)', 1879 setter: 'function(B#[]=)',
1841 index: '42', 1880 index: '42',
1842 operator: '--')), 1881 operator: '--')),
1843 const Test.clazz( 1882 const Test.clazz(
1844 ''' 1883 '''
(...skipping 25 matching lines...) Expand all
1870 operator [](_) => null; 1909 operator [](_) => null;
1871 } 1910 }
1872 class C extends B { 1911 class C extends B {
1873 m() => super[42]--; 1912 m() => super[42]--;
1874 } 1913 }
1875 ''', 1914 ''',
1876 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX, 1915 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_INDEX_POSTFIX,
1877 getter: 'function(B#[])', 1916 getter: 'function(B#[])',
1878 index: '42', 1917 index: '42',
1879 operator: '--')), 1918 operator: '--')),
1919 const Test.clazz(
1920 '''
1921 class B {
1922 operator [](_) => null;
1923 operator []=(a, b) {}
1924 }
1925 class C extends B {
1926 static m() => super[42]--;
1927 }
1928 ''',
1929 const Visit(VisitKind.ERROR_INVALID_INDEX_POSTFIX,
1930 error: MessageKind.NO_SUPER_IN_STATIC,
1931 index: '42',
1932 operator: '--')),
1880 ], 1933 ],
1881 'Equals': const [ 1934 'Equals': const [
1882 // Equals 1935 // Equals
1883 const Test( 1936 const Test(
1884 ''' 1937 '''
1885 m() => 2 == 3; 1938 m() => 2 == 3;
1886 ''', 1939 ''',
1887 const Visit(VisitKind.VISIT_EQUALS, 1940 const Visit(VisitKind.VISIT_EQUALS,
1888 left: '2', right: '3')), 1941 left: '2', right: '3')),
1889 const Test.clazz( 1942 const Test.clazz(
1890 ''' 1943 '''
1891 class B { 1944 class B {
1892 operator ==(_) => null; 1945 operator ==(_) => null;
1893 } 1946 }
1894 class C extends B { 1947 class C extends B {
1895 m() => super == 42; 1948 m() => super == 42;
1896 } 1949 }
1897 ''', 1950 ''',
1898 const Visit(VisitKind.VISIT_SUPER_EQUALS, 1951 const Visit(VisitKind.VISIT_SUPER_EQUALS,
1899 element: 'function(B#==)', 1952 element: 'function(B#==)',
1900 right: '42')), 1953 right: '42')),
1954 const Test.clazz(
1955 '''
1956 class B {
1957 operator ==(_) => null;
1958 }
1959 class C extends B {
1960 static m() => super == 42;
1961 }
1962 ''',
1963 const Visit(VisitKind.ERROR_INVALID_EQUALS,
1964 error: MessageKind.NO_SUPER_IN_STATIC,
1965 right: '42')),
1901 ], 1966 ],
1902 'Not equals': const [ 1967 'Not equals': const [
1903 // Not equals 1968 // Not equals
1904 const Test( 1969 const Test(
1905 ''' 1970 '''
1906 m() => 2 != 3; 1971 m() => 2 != 3;
1907 ''', 1972 ''',
1908 const Visit(VisitKind.VISIT_NOT_EQUALS, 1973 const Visit(VisitKind.VISIT_NOT_EQUALS,
1909 left: '2', right: '3')), 1974 left: '2', right: '3')),
1910 const Test.clazz( 1975 const Test.clazz(
1911 ''' 1976 '''
1912 class B { 1977 class B {
1913 operator ==(_) => null; 1978 operator ==(_) => null;
1914 } 1979 }
1915 class C extends B { 1980 class C extends B {
1916 m() => super != 42; 1981 m() => super != 42;
1917 } 1982 }
1918 ''', 1983 ''',
1919 const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS, 1984 const Visit(VisitKind.VISIT_SUPER_NOT_EQUALS,
1920 element: 'function(B#==)', 1985 element: 'function(B#==)',
1921 right: '42')), 1986 right: '42')),
1987 const Test.clazz(
1988 '''
1989 class B {
1990 operator ==(_) => null;
1991 }
1992 class C extends B {
1993 static m() => super != 42;
1994 }
1995 ''',
1996 const Visit(VisitKind.ERROR_INVALID_NOT_EQUALS,
1997 error: MessageKind.NO_SUPER_IN_STATIC,
1998 right: '42')),
1922 ], 1999 ],
1923 'Unary expression': const [ 2000 'Unary expression': const [
1924 // Unary expression 2001 // Unary expression
1925 const Test( 2002 const Test(
1926 ''' 2003 '''
1927 m() => -false; 2004 m() => -false;
1928 ''', 2005 ''',
1929 const Visit(VisitKind.VISIT_UNARY, 2006 const Visit(VisitKind.VISIT_UNARY,
1930 expression: 'false', operator: '-')), 2007 expression: 'false', operator: '-')),
1931 const Test( 2008 const Test(
(...skipping 27 matching lines...) Expand all
1959 ''' 2036 '''
1960 class B { 2037 class B {
1961 operator ~() => null; 2038 operator ~() => null;
1962 } 2039 }
1963 class C extends B { 2040 class C extends B {
1964 m() => ~super; 2041 m() => ~super;
1965 } 2042 }
1966 ''', 2043 ''',
1967 const Visit(VisitKind.VISIT_SUPER_UNARY, 2044 const Visit(VisitKind.VISIT_SUPER_UNARY,
1968 element: 'function(B#~)', operator: '~')), 2045 element: 'function(B#~)', operator: '~')),
2046 const Test.clazz(
2047 '''
2048 class B {
2049 operator -() => null;
2050 }
2051 class C extends B {
2052 static m() => -super;
2053 }
2054 ''',
2055 const Visit(VisitKind.ERROR_INVALID_UNARY,
2056 error: MessageKind.NO_SUPER_IN_STATIC,
2057 operator: '-')),
1969 const Test( 2058 const Test(
1970 ''' 2059 '''
1971 m() => !0; 2060 m() => !0;
1972 ''', 2061 ''',
1973 const Visit(VisitKind.VISIT_NOT, expression: '0')), 2062 const Visit(VisitKind.VISIT_NOT, expression: '0')),
1974 const Test( 2063 const Test(
1975 ''' 2064 '''
1976 m() => +false; 2065 m() => +false;
1977 ''', 2066 ''',
1978 // TODO(johnniwinther): Should this be an 2067 // TODO(johnniwinther): Should this be an
(...skipping 23 matching lines...) Expand all
2002 const Test.clazz( 2091 const Test.clazz(
2003 ''' 2092 '''
2004 class B { 2093 class B {
2005 } 2094 }
2006 class C extends B { 2095 class C extends B {
2007 m() => super[1] = 2; 2096 m() => super[1] = 2;
2008 } 2097 }
2009 ''', 2098 ''',
2010 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET, 2099 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_INDEX_SET,
2011 index: '1', rhs: '2')), 2100 index: '1', rhs: '2')),
2101 const Test.clazz(
2102 '''
2103 class B {
2104 operator []=(a, b) {}
2105 }
2106 class C extends B {
2107 static m() => super[1] = 2;
2108 }
2109 ''',
2110 const Visit(VisitKind.ERROR_INVALID_INDEX_SET,
2111 error: MessageKind.NO_SUPER_IN_STATIC, index: '1', rhs: '2')),
2012 ], 2112 ],
2013 'Compound assignment': const [ 2113 'Compound assignment': const [
2014 // Compound assignment 2114 // Compound assignment
2015 const Test( 2115 const Test(
2016 ''' 2116 '''
2017 m(a) => a.b += 42; 2117 m(a) => a.b += 42;
2018 ''', 2118 ''',
2019 const [ 2119 const [
2020 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND, 2120 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_COMPOUND,
2021 receiver: 'a', operator: '+=', rhs: '42', 2121 receiver: 'a', operator: '+=', rhs: '42',
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 class B { 2604 class B {
2505 operator [](_) {} 2605 operator [](_) {}
2506 } 2606 }
2507 class C extends B { 2607 class C extends B {
2508 m() => super[1] += 42; 2608 m() => super[1] += 42;
2509 } 2609 }
2510 ''', 2610 ''',
2511 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET, 2611 const Visit(VisitKind.VISIT_UNRESOLVED_SUPER_SETTER_COMPOUND_INDEX_SET,
2512 getter: 'function(B#[])', 2612 getter: 'function(B#[])',
2513 index: '1', operator: '+=', rhs: '42')), 2613 index: '1', operator: '+=', rhs: '42')),
2614 const Test.clazz(
2615 '''
2616 class B {
2617 operator [](_) {}
2618 operator []=(a, b) {}
2619 }
2620 class C extends B {
2621 static m() => super[1] += 42;
2622 }
2623 ''',
2624 const Visit(VisitKind.ERROR_INVALID_COMPOUND_INDEX_SET,
2625 error: MessageKind.NO_SUPER_IN_STATIC,
2626 index: '1', operator: '+=', rhs: '42')),
2514 ], 2627 ],
2515 'Prefix expression': const [ 2628 'Prefix expression': const [
2516 // Prefix expression 2629 // Prefix expression
2517 const Test( 2630 const Test(
2518 ''' 2631 '''
2519 m(a) => --a.b; 2632 m(a) => --a.b;
2520 ''', 2633 ''',
2521 const [ 2634 const [
2522 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX, 2635 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_PREFIX,
2523 receiver: 'a', operator: '--', 2636 receiver: 'a', operator: '--',
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3686 ''' 3799 '''
3687 m(a) => a ??= 42; 3800 m(a) => a ??= 42;
3688 ''', 3801 ''',
3689 const Visit( 3802 const Visit(
3690 VisitKind.VISIT_PARAMETER_COMPOUND, 3803 VisitKind.VISIT_PARAMETER_COMPOUND,
3691 element: 'parameter(m#a)', 3804 element: 'parameter(m#a)',
3692 operator: '??=', 3805 operator: '??=',
3693 rhs: '42')), 3806 rhs: '42')),
3694 ], 3807 ],
3695 }; 3808 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/semantic_visitor_test.dart ('k') | tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698