OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 class C { | 1908 class C { |
1909 factory C() = D.named; | 1909 factory C() = D.named; |
1910 C._(); | 1910 C._(); |
1911 } | 1911 } |
1912 class D extends C { | 1912 class D extends C { |
1913 D.named() : super._(); | 1913 D.named() : super._(); |
1914 } | 1914 } |
1915 '''); | 1915 '''); |
1916 } | 1916 } |
1917 | 1917 |
| 1918 test_constructor_redirected_factory_named_generic() { |
| 1919 checkLibrary(''' |
| 1920 class C<T, U> { |
| 1921 factory C() = D<U, T>.named; |
| 1922 C._(); |
| 1923 } |
| 1924 class D<T, U> extends C<U, T> { |
| 1925 D.named() : super._(); |
| 1926 } |
| 1927 '''); |
| 1928 } |
| 1929 |
1918 test_constructor_redirected_factory_named_imported() { | 1930 test_constructor_redirected_factory_named_imported() { |
1919 addLibrarySource( | 1931 addLibrarySource( |
1920 '/foo.dart', | 1932 '/foo.dart', |
1921 ''' | 1933 ''' |
1922 import 'test.dart'; | 1934 import 'test.dart'; |
1923 class D extends C { | 1935 class D extends C { |
1924 D.named() : super._(); | 1936 D.named() : super._(); |
1925 } | 1937 } |
1926 '''); | 1938 '''); |
1927 checkLibrary(''' | 1939 checkLibrary(''' |
1928 import 'foo.dart'; | 1940 import 'foo.dart'; |
1929 class C { | 1941 class C { |
1930 factory C() = D.named; | 1942 factory C() = D.named; |
1931 C._(); | 1943 C._(); |
1932 } | 1944 } |
1933 '''); | 1945 '''); |
1934 } | 1946 } |
1935 | 1947 |
| 1948 test_constructor_redirected_factory_named_imported_generic() { |
| 1949 addLibrarySource( |
| 1950 '/foo.dart', |
| 1951 ''' |
| 1952 import 'test.dart'; |
| 1953 class D<T, U> extends C<U, T> { |
| 1954 D.named() : super._(); |
| 1955 } |
| 1956 '''); |
| 1957 checkLibrary(''' |
| 1958 import 'foo.dart'; |
| 1959 class C<T, U> { |
| 1960 factory C() = D<U, T>.named; |
| 1961 C._(); |
| 1962 } |
| 1963 '''); |
| 1964 } |
| 1965 |
1936 test_constructor_redirected_factory_named_prefixed() { | 1966 test_constructor_redirected_factory_named_prefixed() { |
1937 addLibrarySource( | 1967 addLibrarySource( |
1938 '/foo.dart', | 1968 '/foo.dart', |
1939 ''' | 1969 ''' |
1940 import 'test.dart'; | 1970 import 'test.dart'; |
1941 class D extends C { | 1971 class D extends C { |
1942 D.named() : super._(); | 1972 D.named() : super._(); |
1943 } | 1973 } |
1944 '''); | 1974 '''); |
1945 checkLibrary(''' | 1975 checkLibrary(''' |
1946 import 'foo.dart' as foo; | 1976 import 'foo.dart' as foo; |
1947 class C { | 1977 class C { |
1948 factory C() = foo.D.named; | 1978 factory C() = foo.D.named; |
1949 C._(); | 1979 C._(); |
1950 } | 1980 } |
1951 '''); | 1981 '''); |
1952 } | 1982 } |
1953 | 1983 |
| 1984 test_constructor_redirected_factory_named_prefixed_generic() { |
| 1985 addLibrarySource( |
| 1986 '/foo.dart', |
| 1987 ''' |
| 1988 import 'test.dart'; |
| 1989 class D<T, U> extends C<U, T> { |
| 1990 D.named() : super._(); |
| 1991 } |
| 1992 '''); |
| 1993 checkLibrary(''' |
| 1994 import 'foo.dart' as foo; |
| 1995 class C<T, U> { |
| 1996 factory C() = foo.D<U, T>.named; |
| 1997 C._(); |
| 1998 } |
| 1999 '''); |
| 2000 } |
| 2001 |
1954 test_constructor_redirected_factory_unnamed() { | 2002 test_constructor_redirected_factory_unnamed() { |
1955 checkLibrary(''' | 2003 checkLibrary(''' |
1956 class C { | 2004 class C { |
1957 factory C() = D; | 2005 factory C() = D; |
1958 C._(); | 2006 C._(); |
1959 } | 2007 } |
1960 class D extends C { | 2008 class D extends C { |
1961 D() : super._(); | 2009 D() : super._(); |
1962 } | 2010 } |
1963 '''); | 2011 '''); |
1964 } | 2012 } |
1965 | 2013 |
| 2014 test_constructor_redirected_factory_unnamed_generic() { |
| 2015 checkLibrary(''' |
| 2016 class C<T, U> { |
| 2017 factory C() = D<U, T>; |
| 2018 C._(); |
| 2019 } |
| 2020 class D<T, U> extends C<U, T> { |
| 2021 D() : super._(); |
| 2022 } |
| 2023 '''); |
| 2024 } |
| 2025 |
1966 test_constructor_redirected_factory_unnamed_imported() { | 2026 test_constructor_redirected_factory_unnamed_imported() { |
1967 addLibrarySource( | 2027 addLibrarySource( |
1968 '/foo.dart', | 2028 '/foo.dart', |
1969 ''' | 2029 ''' |
1970 import 'test.dart'; | 2030 import 'test.dart'; |
1971 class D extends C { | 2031 class D extends C { |
1972 D() : super._(); | 2032 D() : super._(); |
1973 } | 2033 } |
1974 '''); | 2034 '''); |
1975 checkLibrary(''' | 2035 checkLibrary(''' |
1976 import 'foo.dart'; | 2036 import 'foo.dart'; |
1977 class C { | 2037 class C { |
1978 factory C() = D; | 2038 factory C() = D; |
1979 C._(); | 2039 C._(); |
1980 } | 2040 } |
1981 '''); | 2041 '''); |
1982 } | 2042 } |
1983 | 2043 |
| 2044 test_constructor_redirected_factory_unnamed_imported_generic() { |
| 2045 addLibrarySource( |
| 2046 '/foo.dart', |
| 2047 ''' |
| 2048 import 'test.dart'; |
| 2049 class D<T, U> extends C<U, T> { |
| 2050 D() : super._(); |
| 2051 } |
| 2052 '''); |
| 2053 checkLibrary(''' |
| 2054 import 'foo.dart'; |
| 2055 class C<T, U> { |
| 2056 factory C() = D<U, T>; |
| 2057 C._(); |
| 2058 } |
| 2059 '''); |
| 2060 } |
| 2061 |
1984 test_constructor_redirected_factory_unnamed_prefixed() { | 2062 test_constructor_redirected_factory_unnamed_prefixed() { |
1985 addLibrarySource( | 2063 addLibrarySource( |
1986 '/foo.dart', | 2064 '/foo.dart', |
1987 ''' | 2065 ''' |
1988 import 'test.dart'; | 2066 import 'test.dart'; |
1989 class D extends C { | 2067 class D extends C { |
1990 D() : super._(); | 2068 D() : super._(); |
1991 } | 2069 } |
1992 '''); | 2070 '''); |
1993 checkLibrary(''' | 2071 checkLibrary(''' |
1994 import 'foo.dart' as foo; | 2072 import 'foo.dart' as foo; |
1995 class C { | 2073 class C { |
1996 factory C() = foo.D; | 2074 factory C() = foo.D; |
1997 C._(); | 2075 C._(); |
1998 } | 2076 } |
1999 '''); | 2077 '''); |
2000 } | 2078 } |
2001 | 2079 |
| 2080 test_constructor_redirected_factory_unnamed_prefixed_generic() { |
| 2081 addLibrarySource( |
| 2082 '/foo.dart', |
| 2083 ''' |
| 2084 import 'test.dart'; |
| 2085 class D<T, U> extends C<U, T> { |
| 2086 D() : super._(); |
| 2087 } |
| 2088 '''); |
| 2089 checkLibrary(''' |
| 2090 import 'foo.dart' as foo; |
| 2091 class C<T, U> { |
| 2092 factory C() = foo.D<U, T>; |
| 2093 C._(); |
| 2094 } |
| 2095 '''); |
| 2096 } |
| 2097 |
2002 test_constructor_redirected_thisInvocation_named() { | 2098 test_constructor_redirected_thisInvocation_named() { |
2003 checkLibrary(''' | 2099 checkLibrary(''' |
2004 class C { | 2100 class C { |
2005 C.named(); | 2101 C.named(); |
2006 C() : this.named(); | 2102 C() : this.named(); |
2007 } | 2103 } |
2008 '''); | 2104 '''); |
2009 } | 2105 } |
2010 | 2106 |
2011 test_constructor_redirected_thisInvocation_named_generic() { | 2107 test_constructor_redirected_thisInvocation_named_generic() { |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3240 fail('Unexpectedly tried to get unlinked summary for $uri'); |
3145 } | 3241 } |
3146 return serializedUnit; | 3242 return serializedUnit; |
3147 } | 3243 } |
3148 | 3244 |
3149 @override | 3245 @override |
3150 bool hasLibrarySummary(String uri) { | 3246 bool hasLibrarySummary(String uri) { |
3151 return true; | 3247 return true; |
3152 } | 3248 } |
3153 } | 3249 } |
OLD | NEW |