| 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:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| (...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4324 x/*location: test.dart;C;x*/ = 42; | 4324 x/*location: test.dart;C;x*/ = 42; |
| 4325 } | 4325 } |
| 4326 '''); | 4326 '''); |
| 4327 } | 4327 } |
| 4328 | 4328 |
| 4329 test_constructor_initializers_field_notConst() async { | 4329 test_constructor_initializers_field_notConst() async { |
| 4330 variablesWithNotConstInitializers.add('x'); | 4330 variablesWithNotConstInitializers.add('x'); |
| 4331 var library = await checkLibrary(''' | 4331 var library = await checkLibrary(''' |
| 4332 class C { | 4332 class C { |
| 4333 final x; | 4333 final x; |
| 4334 const A() : x = foo(); | 4334 const C() : x = foo(); |
| 4335 } | 4335 } |
| 4336 int foo() => 42; | 4336 int foo() => 42; |
| 4337 ''', allowErrors: true); | 4337 ''', allowErrors: true); |
| 4338 checkElementText(library, r''' | 4338 checkElementText(library, r''' |
| 4339 class C { | 4339 class C { |
| 4340 final dynamic x; | 4340 final dynamic x; |
| 4341 const C() : | 4341 const C() : |
| 4342 x/*location: test.dart;C;x*/ = | 4342 x/*location: test.dart;C;x*/ = |
| 4343 $$invalidConstExpr$$/*location: null*/; | 4343 $$invalidConstExpr$$/*location: null*/; |
| 4344 } | 4344 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4376 class A { | 4376 class A { |
| 4377 const A.aaa(int p); | 4377 const A.aaa(int p); |
| 4378 } | 4378 } |
| 4379 class C extends A { | 4379 class C extends A { |
| 4380 const C() : super. | 4380 const C() : super. |
| 4381 aaa/*location: test.dart;A;aaa*/(42); | 4381 aaa/*location: test.dart;A;aaa*/(42); |
| 4382 } | 4382 } |
| 4383 '''); | 4383 '''); |
| 4384 } | 4384 } |
| 4385 | 4385 |
| 4386 test_constructor_initializers_superInvocation_named_underscore() async { |
| 4387 var library = await checkLibrary(''' |
| 4388 class A { |
| 4389 const A._(); |
| 4390 } |
| 4391 class B extends A { |
| 4392 const B() : super._(); |
| 4393 } |
| 4394 '''); |
| 4395 checkElementText(library, r''' |
| 4396 class A { |
| 4397 const A._(); |
| 4398 } |
| 4399 class B extends A { |
| 4400 const B() : super. |
| 4401 _/*location: test.dart;A;_*/(); |
| 4402 } |
| 4403 '''); |
| 4404 } |
| 4405 |
| 4386 test_constructor_initializers_superInvocation_namedExpression() async { | 4406 test_constructor_initializers_superInvocation_namedExpression() async { |
| 4387 var library = await checkLibrary(''' | 4407 var library = await checkLibrary(''' |
| 4388 class A { | 4408 class A { |
| 4389 const A.aaa(a, {int b}); | 4409 const A.aaa(a, {int b}); |
| 4390 } | 4410 } |
| 4391 class C extends A { | 4411 class C extends A { |
| 4392 const C() : super.aaa(1, b: 2); | 4412 const C() : super.aaa(1, b: 2); |
| 4393 } | 4413 } |
| 4394 '''); | 4414 '''); |
| 4395 checkElementText(library, r''' | 4415 checkElementText(library, r''' |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4872 var library = await checkLibrary(''' | 4892 var library = await checkLibrary(''' |
| 4873 class C { | 4893 class C { |
| 4874 final x; | 4894 final x; |
| 4875 C() : x = new D(); | 4895 C() : x = new D(); |
| 4876 } | 4896 } |
| 4877 class D { | 4897 class D { |
| 4878 final x; | 4898 final x; |
| 4879 D() : x = new C(); | 4899 D() : x = new C(); |
| 4880 } | 4900 } |
| 4881 '''); | 4901 '''); |
| 4882 checkElementText(library, r''' | 4902 if (isSharedFrontEnd) { |
| 4903 // The shared front-end keeps initializers for cycled constructors. |
| 4904 checkElementText(library, r''' |
| 4905 class C { |
| 4906 final dynamic x; |
| 4907 C() : |
| 4908 x/*location: test.dart;C;x*/ = new |
| 4909 D/*location: test.dart;D*/(); |
| 4910 } |
| 4911 class D { |
| 4912 final dynamic x; |
| 4913 D() : |
| 4914 x/*location: test.dart;D;x*/ = new |
| 4915 C/*location: test.dart;C*/(); |
| 4916 } |
| 4917 '''); |
| 4918 } else { |
| 4919 checkElementText(library, r''' |
| 4883 class C { | 4920 class C { |
| 4884 final dynamic x; | 4921 final dynamic x; |
| 4885 C(); | 4922 C(); |
| 4886 } | 4923 } |
| 4887 class D { | 4924 class D { |
| 4888 final dynamic x; | 4925 final dynamic x; |
| 4889 D(); | 4926 D(); |
| 4890 } | 4927 } |
| 4891 '''); | 4928 '''); |
| 4929 } |
| 4892 } | 4930 } |
| 4893 | 4931 |
| 4894 test_defaultValue_refersToGenericClass_constructor() async { | 4932 test_defaultValue_refersToGenericClass_constructor() async { |
| 4895 var library = await checkLibrary(''' | 4933 var library = await checkLibrary(''' |
| 4896 class B<T> { | 4934 class B<T> { |
| 4897 const B(); | 4935 const B(); |
| 4898 } | 4936 } |
| 4899 class C<T> { | 4937 class C<T> { |
| 4900 const C([B<T> b = const B()]); | 4938 const C([B<T> b = const B()]); |
| 4901 } | 4939 } |
| (...skipping 4954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9856 fail('Unexpectedly tried to get unlinked summary for $uri'); | 9894 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 9857 } | 9895 } |
| 9858 return serializedUnit; | 9896 return serializedUnit; |
| 9859 } | 9897 } |
| 9860 | 9898 |
| 9861 @override | 9899 @override |
| 9862 bool hasLibrarySummary(String uri) { | 9900 bool hasLibrarySummary(String uri) { |
| 9863 return true; | 9901 return true; |
| 9864 } | 9902 } |
| 9865 } | 9903 } |
| OLD | NEW |