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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2815713003: Issue 29109. Resynthesize PrefixElement(s) to fix constants evaluation. (Closed)
Patch Set: Created 3 years, 8 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 library test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
9 import 'package:analyzer/dart/constant/value.dart'; 9 import 'package:analyzer/dart/constant/value.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 3722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 import 'a.dart' as p; 3733 import 'a.dart' as p;
3734 const V = const p.C.named(); 3734 const V = const p.C.named();
3735 ''', 3735 ''',
3736 allowErrors: true); 3736 allowErrors: true);
3737 if (isStrongMode) { 3737 if (isStrongMode) {
3738 checkElementText( 3738 checkElementText(
3739 library, 3739 library,
3740 r''' 3740 r'''
3741 import 'a.dart' as p; 3741 import 'a.dart' as p;
3742 const C V = const 3742 const C V = const
3743 p/*location: null*/. 3743 p/*location: test.dart;p*/.
3744 C/*location: a.dart;C*/. 3744 C/*location: a.dart;C*/.
3745 named/*location: null*/(); 3745 named/*location: null*/();
3746 '''); 3746 ''');
3747 } else { 3747 } else {
3748 checkElementText( 3748 checkElementText(
3749 library, 3749 library,
3750 r''' 3750 r'''
3751 import 'a.dart' as p; 3751 import 'a.dart' as p;
3752 const dynamic V = const 3752 const dynamic V = const
3753 p/*location: null*/. 3753 p/*location: test.dart;p*/.
3754 C/*location: a.dart;C*/. 3754 C/*location: a.dart;C*/.
3755 named/*location: null*/(); 3755 named/*location: null*/();
3756 '''); 3756 ''');
3757 } 3757 }
3758 } 3758 }
3759 3759
3760 test_const_invokeConstructor_named_unresolved4() { 3760 test_const_invokeConstructor_named_unresolved4() {
3761 addLibrarySource('/a.dart', ''); 3761 addLibrarySource('/a.dart', '');
3762 var library = checkLibrary( 3762 var library = checkLibrary(
3763 r''' 3763 r'''
3764 import 'a.dart' as p; 3764 import 'a.dart' as p;
3765 const V = const p.C.named(); 3765 const V = const p.C.named();
3766 ''', 3766 ''',
3767 allowErrors: true); 3767 allowErrors: true);
3768 if (isStrongMode) { 3768 if (isStrongMode) {
3769 checkElementText( 3769 checkElementText(
3770 library, 3770 library,
3771 r''' 3771 r'''
3772 import 'a.dart' as p; 3772 import 'a.dart' as p;
3773 const dynamic V = const 3773 const dynamic V = const
3774 p/*location: null*/. 3774 p/*location: test.dart;p*/.
3775 C/*location: null*/. 3775 C/*location: null*/.
3776 named/*location: null*/(); 3776 named/*location: null*/();
3777 '''); 3777 ''');
3778 } else { 3778 } else {
3779 checkElementText( 3779 checkElementText(
3780 library, 3780 library,
3781 r''' 3781 r'''
3782 import 'a.dart' as p; 3782 import 'a.dart' as p;
3783 const dynamic V = const 3783 const dynamic V = const
3784 p/*location: null*/. 3784 p/*location: test.dart;p*/.
3785 C/*location: null*/. 3785 C/*location: null*/.
3786 named/*location: null*/(); 3786 named/*location: null*/();
3787 '''); 3787 ''');
3788 } 3788 }
3789 } 3789 }
3790 3790
3791 test_const_invokeConstructor_named_unresolved5() { 3791 test_const_invokeConstructor_named_unresolved5() {
3792 var library = checkLibrary( 3792 var library = checkLibrary(
3793 r''' 3793 r'''
3794 const V = const p.C.named(); 3794 const V = const p.C.named();
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 checkElementText( 3954 checkElementText(
3955 library, 3955 library,
3956 r''' 3956 r'''
3957 const dynamic V = const 3957 const dynamic V = const
3958 C/*location: null*/(); 3958 C/*location: null*/();
3959 '''); 3959 ''');
3960 } 3960 }
3961 } 3961 }
3962 3962
3963 test_const_invokeConstructor_unnamed_unresolved2() { 3963 test_const_invokeConstructor_unnamed_unresolved2() {
3964 shouldCompareLibraryElements = false;
3964 addLibrarySource('/a.dart', ''); 3965 addLibrarySource('/a.dart', '');
3965 var library = checkLibrary( 3966 var library = checkLibrary(
3966 r''' 3967 r'''
3967 import 'a.dart' as p; 3968 import 'a.dart' as p;
3968 const V = const p.C(); 3969 const V = const p.C();
3969 ''', 3970 ''',
3970 allowErrors: true); 3971 allowErrors: true);
3971 if (isStrongMode) { 3972 if (isStrongMode) {
3972 checkElementText( 3973 checkElementText(
3973 library, 3974 library,
3974 r''' 3975 r'''
3975 import 'a.dart' as p; 3976 import 'a.dart' as p;
3976 const dynamic V = const 3977 const dynamic V = const
3977 p/*location: null*/. 3978 p/*location: test.dart;p*/.
3978 C/*location: null*/(); 3979 C/*location: null*/();
3979 '''); 3980 ''');
3980 } else { 3981 } else {
3981 checkElementText( 3982 checkElementText(
3982 library, 3983 library,
3983 r''' 3984 r'''
3984 import 'a.dart' as p; 3985 import 'a.dart' as p;
3985 const dynamic V = const 3986 const dynamic V = const
3986 p/*location: null*/. 3987 p/*location: test.dart;p*/.
3987 C/*location: null*/(); 3988 C/*location: null*/();
3988 '''); 3989 ''');
3989 } 3990 }
3990 } 3991 }
3991 3992
3992 test_const_invokeConstructor_unnamed_unresolved3() { 3993 test_const_invokeConstructor_unnamed_unresolved3() {
3993 var library = checkLibrary( 3994 var library = checkLibrary(
3994 r''' 3995 r'''
3995 const V = const p.C(); 3996 const V = const p.C();
3996 ''', 3997 ''',
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4094 var library = checkLibrary(r''' 4095 var library = checkLibrary(r'''
4095 import 'a.dart' as p; 4096 import 'a.dart' as p;
4096 const int v = p.C.F.length; 4097 const int v = p.C.F.length;
4097 '''); 4098 ''');
4098 if (isStrongMode) { 4099 if (isStrongMode) {
4099 checkElementText( 4100 checkElementText(
4100 library, 4101 library,
4101 r''' 4102 r'''
4102 import 'a.dart' as p; 4103 import 'a.dart' as p;
4103 const int v = 4104 const int v =
4104 p/*location: null*/. 4105 p/*location: test.dart;p*/.
4105 C/*location: a.dart;C*/. 4106 C/*location: a.dart;C*/.
4106 F/*location: a.dart;C;F?*/. 4107 F/*location: a.dart;C;F?*/.
4107 length/*location: dart:core;String;length?*/; 4108 length/*location: dart:core;String;length?*/;
4108 '''); 4109 ''');
4109 } else { 4110 } else {
4110 checkElementText( 4111 checkElementText(
4111 library, 4112 library,
4112 r''' 4113 r'''
4113 import 'a.dart' as p; 4114 import 'a.dart' as p;
4114 const int v = 4115 const int v =
4115 p/*location: null*/. 4116 p/*location: test.dart;p*/.
4116 C/*location: a.dart;C*/. 4117 C/*location: a.dart;C*/.
4117 F/*location: a.dart;C;F?*/. 4118 F/*location: a.dart;C;F?*/.
4118 length/*location: dart:core;String;length?*/; 4119 length/*location: dart:core;String;length?*/;
4119 '''); 4120 ''');
4120 } 4121 }
4121 } 4122 }
4122 4123
4123 test_const_length_ofStringLiteral() { 4124 test_const_length_ofStringLiteral() {
4124 var library = checkLibrary(r''' 4125 var library = checkLibrary(r'''
4125 const v = 'abc'.length; 4126 const v = 'abc'.length;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4207 var library = checkLibrary(r''' 4208 var library = checkLibrary(r'''
4208 import 'a.dart' as p; 4209 import 'a.dart' as p;
4209 const v = p.S.length; 4210 const v = p.S.length;
4210 '''); 4211 ''');
4211 if (isStrongMode) { 4212 if (isStrongMode) {
4212 checkElementText( 4213 checkElementText(
4213 library, 4214 library,
4214 r''' 4215 r'''
4215 import 'a.dart' as p; 4216 import 'a.dart' as p;
4216 const dynamic v/*error: instanceGetter*/ = 4217 const dynamic v/*error: instanceGetter*/ =
4217 p/*location: null*/. 4218 p/*location: test.dart;p*/.
4218 S/*location: a.dart;S?*/. 4219 S/*location: a.dart;S?*/.
4219 length/*location: dart:core;String;length?*/; 4220 length/*location: dart:core;String;length?*/;
4220 '''); 4221 ''');
4221 } else { 4222 } else {
4222 checkElementText( 4223 checkElementText(
4223 library, 4224 library,
4224 r''' 4225 r'''
4225 import 'a.dart' as p; 4226 import 'a.dart' as p;
4226 const dynamic v = 4227 const dynamic v =
4227 p/*location: null*/. 4228 p/*location: test.dart;p*/.
4228 S/*location: a.dart;S?*/. 4229 S/*location: a.dart;S?*/.
4229 length/*location: dart:core;String;length?*/; 4230 length/*location: dart:core;String;length?*/;
4230 '''); 4231 ''');
4231 } 4232 }
4232 } 4233 }
4233 4234
4234 test_const_length_staticMethod() { 4235 test_const_length_staticMethod() {
4235 var library = checkLibrary(r''' 4236 var library = checkLibrary(r'''
4236 class C { 4237 class C {
4237 static int length() => 42; 4238 static int length() => 42;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 var library = checkLibrary(r''' 4467 var library = checkLibrary(r'''
4467 import 'a.dart' as p; 4468 import 'a.dart' as p;
4468 const V = p.C.F; 4469 const V = p.C.F;
4469 '''); 4470 ''');
4470 if (isStrongMode) { 4471 if (isStrongMode) {
4471 checkElementText( 4472 checkElementText(
4472 library, 4473 library,
4473 r''' 4474 r'''
4474 import 'a.dart' as p; 4475 import 'a.dart' as p;
4475 const int V = 4476 const int V =
4476 p/*location: null*/. 4477 p/*location: test.dart;p*/.
4477 C/*location: a.dart;C*/. 4478 C/*location: a.dart;C*/.
4478 F/*location: a.dart;C;F?*/; 4479 F/*location: a.dart;C;F?*/;
4479 '''); 4480 ''');
4480 } else { 4481 } else {
4481 checkElementText( 4482 checkElementText(
4482 library, 4483 library,
4483 r''' 4484 r'''
4484 import 'a.dart' as p; 4485 import 'a.dart' as p;
4485 const dynamic V = 4486 const dynamic V =
4486 p/*location: null*/. 4487 p/*location: test.dart;p*/.
4487 C/*location: a.dart;C*/. 4488 C/*location: a.dart;C*/.
4488 F/*location: a.dart;C;F?*/; 4489 F/*location: a.dart;C;F?*/;
4489 '''); 4490 ''');
4490 } 4491 }
4491 } 4492 }
4492 4493
4493 test_const_reference_staticMethod() { 4494 test_const_reference_staticMethod() {
4494 var library = checkLibrary(r''' 4495 var library = checkLibrary(r'''
4495 class C { 4496 class C {
4496 static int m(int a, String b) => 42; 4497 static int m(int a, String b) => 42;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
4566 var library = checkLibrary(r''' 4567 var library = checkLibrary(r'''
4567 import 'a.dart' as p; 4568 import 'a.dart' as p;
4568 const V = p.C.m; 4569 const V = p.C.m;
4569 '''); 4570 ''');
4570 if (isStrongMode) { 4571 if (isStrongMode) {
4571 checkElementText( 4572 checkElementText(
4572 library, 4573 library,
4573 r''' 4574 r'''
4574 import 'a.dart' as p; 4575 import 'a.dart' as p;
4575 const (int, String) → int V = 4576 const (int, String) → int V =
4576 p/*location: null*/. 4577 p/*location: test.dart;p*/.
4577 C/*location: a.dart;C*/. 4578 C/*location: a.dart;C*/.
4578 m/*location: a.dart;C;m*/; 4579 m/*location: a.dart;C;m*/;
4579 '''); 4580 ''');
4580 } else { 4581 } else {
4581 checkElementText( 4582 checkElementText(
4582 library, 4583 library,
4583 r''' 4584 r'''
4584 import 'a.dart' as p; 4585 import 'a.dart' as p;
4585 const dynamic V = 4586 const dynamic V =
4586 p/*location: null*/. 4587 p/*location: test.dart;p*/.
4587 C/*location: a.dart;C*/. 4588 C/*location: a.dart;C*/.
4588 m/*location: a.dart;C;m*/; 4589 m/*location: a.dart;C;m*/;
4589 '''); 4590 ''');
4590 } 4591 }
4591 } 4592 }
4592 4593
4593 test_const_reference_topLevelFunction() { 4594 test_const_reference_topLevelFunction() {
4594 var library = checkLibrary(r''' 4595 var library = checkLibrary(r'''
4595 foo() {} 4596 foo() {}
4596 const V = foo; 4597 const V = foo;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4652 var library = checkLibrary(r''' 4653 var library = checkLibrary(r'''
4653 import 'a.dart' as p; 4654 import 'a.dart' as p;
4654 const V = p.foo; 4655 const V = p.foo;
4655 '''); 4656 ''');
4656 if (isStrongMode) { 4657 if (isStrongMode) {
4657 checkElementText( 4658 checkElementText(
4658 library, 4659 library,
4659 r''' 4660 r'''
4660 import 'a.dart' as p; 4661 import 'a.dart' as p;
4661 const () → dynamic V = 4662 const () → dynamic V =
4662 p/*location: null*/. 4663 p/*location: test.dart;p*/.
4663 foo/*location: a.dart;foo*/; 4664 foo/*location: a.dart;foo*/;
4664 '''); 4665 ''');
4665 } else { 4666 } else {
4666 checkElementText( 4667 checkElementText(
4667 library, 4668 library,
4668 r''' 4669 r'''
4669 import 'a.dart' as p; 4670 import 'a.dart' as p;
4670 const dynamic V = 4671 const dynamic V =
4671 p/*location: null*/. 4672 p/*location: test.dart;p*/.
4672 foo/*location: a.dart;foo*/; 4673 foo/*location: a.dart;foo*/;
4673 '''); 4674 ''');
4674 } 4675 }
4675 } 4676 }
4676 4677
4677 test_const_reference_topLevelVariable() { 4678 test_const_reference_topLevelVariable() {
4678 var library = checkLibrary(r''' 4679 var library = checkLibrary(r'''
4679 const A = 1; 4680 const A = 1;
4680 const B = A + 2; 4681 const B = A + 2;
4681 '''); 4682 ''');
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4736 var library = checkLibrary(r''' 4737 var library = checkLibrary(r'''
4737 import 'a.dart' as p; 4738 import 'a.dart' as p;
4738 const B = p.A + 2; 4739 const B = p.A + 2;
4739 '''); 4740 ''');
4740 if (isStrongMode) { 4741 if (isStrongMode) {
4741 checkElementText( 4742 checkElementText(
4742 library, 4743 library,
4743 r''' 4744 r'''
4744 import 'a.dart' as p; 4745 import 'a.dart' as p;
4745 const int B = 4746 const int B =
4746 p/*location: null*/. 4747 p/*location: test.dart;p*/.
4747 A/*location: a.dart;A?*/ + 2; 4748 A/*location: a.dart;A?*/ + 2;
4748 '''); 4749 ''');
4749 } else { 4750 } else {
4750 checkElementText( 4751 checkElementText(
4751 library, 4752 library,
4752 r''' 4753 r'''
4753 import 'a.dart' as p; 4754 import 'a.dart' as p;
4754 const dynamic B = 4755 const dynamic B =
4755 p/*location: null*/. 4756 p/*location: test.dart;p*/.
4756 A/*location: a.dart;A?*/ + 2; 4757 A/*location: a.dart;A?*/ + 2;
4757 '''); 4758 ''');
4758 } 4759 }
4759 } 4760 }
4760 4761
4761 test_const_reference_type() { 4762 test_const_reference_type() {
4762 var library = checkLibrary(r''' 4763 var library = checkLibrary(r'''
4763 class C {} 4764 class C {}
4764 class D<T> {} 4765 class D<T> {}
4765 enum E {a, b, c} 4766 enum E {a, b, c}
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 const vClass = p.C; 4922 const vClass = p.C;
4922 const vEnum = p.E; 4923 const vEnum = p.E;
4923 const vFunctionTypeAlias = p.F; 4924 const vFunctionTypeAlias = p.F;
4924 '''); 4925 ''');
4925 if (isStrongMode) { 4926 if (isStrongMode) {
4926 checkElementText( 4927 checkElementText(
4927 library, 4928 library,
4928 r''' 4929 r'''
4929 import 'a.dart' as p; 4930 import 'a.dart' as p;
4930 const Type vClass = 4931 const Type vClass =
4931 p/*location: null*/. 4932 p/*location: test.dart;p*/.
4932 C/*location: a.dart;C*/; 4933 C/*location: a.dart;C*/;
4933 const Type vEnum = 4934 const Type vEnum =
4934 p/*location: null*/. 4935 p/*location: test.dart;p*/.
4935 E/*location: a.dart;E*/; 4936 E/*location: a.dart;E*/;
4936 const Type vFunctionTypeAlias = 4937 const Type vFunctionTypeAlias =
4937 p/*location: null*/. 4938 p/*location: test.dart;p*/.
4938 F/*location: a.dart;F*/; 4939 F/*location: a.dart;F*/;
4939 '''); 4940 ''');
4940 } else { 4941 } else {
4941 checkElementText( 4942 checkElementText(
4942 library, 4943 library,
4943 r''' 4944 r'''
4944 import 'a.dart' as p; 4945 import 'a.dart' as p;
4945 const dynamic vClass = 4946 const dynamic vClass =
4946 p/*location: null*/. 4947 p/*location: test.dart;p*/.
4947 C/*location: a.dart;C*/; 4948 C/*location: a.dart;C*/;
4948 const dynamic vEnum = 4949 const dynamic vEnum =
4949 p/*location: null*/. 4950 p/*location: test.dart;p*/.
4950 E/*location: a.dart;E*/; 4951 E/*location: a.dart;E*/;
4951 const dynamic vFunctionTypeAlias = 4952 const dynamic vFunctionTypeAlias =
4952 p/*location: null*/. 4953 p/*location: test.dart;p*/.
4953 F/*location: a.dart;F*/; 4954 F/*location: a.dart;F*/;
4954 '''); 4955 ''');
4955 } 4956 }
4956 } 4957 }
4957 4958
4958 test_const_reference_type_typeParameter() { 4959 test_const_reference_type_typeParameter() {
4959 var library = checkLibrary(r''' 4960 var library = checkLibrary(r'''
4960 class C<T> { 4961 class C<T> {
4961 final f = <T>[]; 4962 final f = <T>[];
4962 } 4963 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 import 'foo.dart' as p; 5047 import 'foo.dart' as p;
5047 const v = p.C.foo; 5048 const v = p.C.foo;
5048 ''', 5049 ''',
5049 allowErrors: true); 5050 allowErrors: true);
5050 if (isStrongMode) { 5051 if (isStrongMode) {
5051 checkElementText( 5052 checkElementText(
5052 library, 5053 library,
5053 r''' 5054 r'''
5054 import 'foo.dart' as p; 5055 import 'foo.dart' as p;
5055 const dynamic v = 5056 const dynamic v =
5056 p/*location: null*/. 5057 p/*location: test.dart;p*/.
5057 C/*location: foo.dart;C*/. 5058 C/*location: foo.dart;C*/.
5058 foo/*location: null*/; 5059 foo/*location: null*/;
5059 '''); 5060 ''');
5060 } else { 5061 } else {
5061 checkElementText( 5062 checkElementText(
5062 library, 5063 library,
5063 r''' 5064 r'''
5064 import 'foo.dart' as p; 5065 import 'foo.dart' as p;
5065 const dynamic v = 5066 const dynamic v =
5066 p/*location: null*/. 5067 p/*location: test.dart;p*/.
5067 C/*location: foo.dart;C*/. 5068 C/*location: foo.dart;C*/.
5068 foo/*location: null*/; 5069 foo/*location: null*/;
5069 '''); 5070 ''');
5070 } 5071 }
5071 } 5072 }
5072 5073
5073 test_const_topLevel_binary() { 5074 test_const_topLevel_binary() {
5074 var library = checkLibrary(r''' 5075 var library = checkLibrary(r'''
5075 const vEqual = 1 == 2; 5076 const vEqual = 1 == 2;
5076 const vAnd = true && false; 5077 const vAnd = true && false;
(...skipping 4819 matching lines...) Expand 10 before | Expand all | Expand 10 after
9896 import "a.dart" as a; 9897 import "a.dart" as a;
9897 @a.C.named 9898 @a.C.named
9898 class D {} 9899 class D {}
9899 '''); 9900 ''');
9900 if (isStrongMode) { 9901 if (isStrongMode) {
9901 checkElementText( 9902 checkElementText(
9902 library, 9903 library,
9903 r''' 9904 r'''
9904 import 'a.dart' as a; 9905 import 'a.dart' as a;
9905 @ 9906 @
9906 a/*location: null*/. 9907 a/*location: test.dart;a*/.
9907 C/*location: a.dart;C*/. 9908 C/*location: a.dart;C*/.
9908 named/*location: a.dart;C;named*/ 9909 named/*location: a.dart;C;named*/
9909 class D { 9910 class D {
9910 } 9911 }
9911 '''); 9912 ''');
9912 } else { 9913 } else {
9913 checkElementText( 9914 checkElementText(
9914 library, 9915 library,
9915 r''' 9916 r'''
9916 import 'a.dart' as a; 9917 import 'a.dart' as a;
9917 @ 9918 @
9918 a/*location: null*/. 9919 a/*location: test.dart;a*/.
9919 C/*location: a.dart;C*/. 9920 C/*location: a.dart;C*/.
9920 named/*location: a.dart;C;named*/ 9921 named/*location: a.dart;C;named*/
9921 class D { 9922 class D {
9922 } 9923 }
9923 '''); 9924 ''');
9924 } 9925 }
9925 } 9926 }
9926 9927
9927 test_invalid_annotation_unprefixed_constructor() { 9928 test_invalid_annotation_unprefixed_constructor() {
9928 addLibrarySource( 9929 addLibrarySource(
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
11625 11626
11626 test_metadata_prefixed_variable() { 11627 test_metadata_prefixed_variable() {
11627 addLibrarySource('/a.dart', 'const b = null;'); 11628 addLibrarySource('/a.dart', 'const b = null;');
11628 var library = checkLibrary('import "a.dart" as a; @a.b class C {}'); 11629 var library = checkLibrary('import "a.dart" as a; @a.b class C {}');
11629 if (isStrongMode) { 11630 if (isStrongMode) {
11630 checkElementText( 11631 checkElementText(
11631 library, 11632 library,
11632 r''' 11633 r'''
11633 import 'a.dart' as a; 11634 import 'a.dart' as a;
11634 @ 11635 @
11635 a/*location: null*/. 11636 a/*location: test.dart;a*/.
11636 b/*location: a.dart;b?*/ 11637 b/*location: a.dart;b?*/
11637 class C { 11638 class C {
11638 } 11639 }
11639 '''); 11640 ''');
11640 } else { 11641 } else {
11641 checkElementText( 11642 checkElementText(
11642 library, 11643 library,
11643 r''' 11644 r'''
11644 import 'a.dart' as a; 11645 import 'a.dart' as a;
11645 @ 11646 @
11646 a/*location: null*/. 11647 a/*location: test.dart;a*/.
11647 b/*location: a.dart;b?*/ 11648 b/*location: a.dart;b?*/
11648 class C { 11649 class C {
11649 } 11650 }
11650 '''); 11651 ''');
11651 } 11652 }
11652 } 11653 }
11653 11654
11654 test_metadata_simpleFormalParameter() { 11655 test_metadata_simpleFormalParameter() {
11655 var library = checkLibrary('const a = null; f(@a x) {}'); 11656 var library = checkLibrary('const a = null; f(@a x) {}');
11656 if (isStrongMode) { 11657 if (isStrongMode) {
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after
14439 test_unresolved_annotation_prefixedIdentifier_noDeclaration() { 14440 test_unresolved_annotation_prefixedIdentifier_noDeclaration() {
14440 var library = checkLibrary( 14441 var library = checkLibrary(
14441 'import "dart:async" as foo; @foo.bar class C {}', 14442 'import "dart:async" as foo; @foo.bar class C {}',
14442 allowErrors: true); 14443 allowErrors: true);
14443 if (isStrongMode) { 14444 if (isStrongMode) {
14444 checkElementText( 14445 checkElementText(
14445 library, 14446 library,
14446 r''' 14447 r'''
14447 import 'dart:async' as foo; 14448 import 'dart:async' as foo;
14448 @ 14449 @
14449 foo/*location: null*/. 14450 foo/*location: test.dart;foo*/.
14450 bar/*location: null*/ 14451 bar/*location: null*/
14451 class C { 14452 class C {
14452 } 14453 }
14453 '''); 14454 ''');
14454 } else { 14455 } else {
14455 checkElementText( 14456 checkElementText(
14456 library, 14457 library,
14457 r''' 14458 r'''
14458 import 'dart:async' as foo; 14459 import 'dart:async' as foo;
14459 @ 14460 @
14460 foo/*location: null*/. 14461 foo/*location: test.dart;foo*/.
14461 bar/*location: null*/ 14462 bar/*location: null*/
14462 class C { 14463 class C {
14463 } 14464 }
14464 '''); 14465 ''');
14465 } 14466 }
14466 } 14467 }
14467 14468
14468 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() { 14469 test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() {
14469 var library = checkLibrary('@foo.bar.baz() class C {}', allowErrors: true); 14470 var library = checkLibrary('@foo.bar.baz() class C {}', allowErrors: true);
14470 if (isStrongMode) { 14471 if (isStrongMode) {
(...skipping 24 matching lines...) Expand all
14495 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() { 14496 test_unresolved_annotation_prefixedNamedConstructorCall_noClass() {
14496 var library = checkLibrary( 14497 var library = checkLibrary(
14497 'import "dart:async" as foo; @foo.bar.baz() class C {}', 14498 'import "dart:async" as foo; @foo.bar.baz() class C {}',
14498 allowErrors: true); 14499 allowErrors: true);
14499 if (isStrongMode) { 14500 if (isStrongMode) {
14500 checkElementText( 14501 checkElementText(
14501 library, 14502 library,
14502 r''' 14503 r'''
14503 import 'dart:async' as foo; 14504 import 'dart:async' as foo;
14504 @ 14505 @
14505 foo/*location: null*/. 14506 foo/*location: test.dart;foo*/.
14506 bar/*location: null*/. 14507 bar/*location: null*/.
14507 baz/*location: null*/() 14508 baz/*location: null*/()
14508 class C { 14509 class C {
14509 } 14510 }
14510 '''); 14511 ''');
14511 } else { 14512 } else {
14512 checkElementText( 14513 checkElementText(
14513 library, 14514 library,
14514 r''' 14515 r'''
14515 import 'dart:async' as foo; 14516 import 'dart:async' as foo;
14516 @ 14517 @
14517 foo/*location: null*/. 14518 foo/*location: test.dart;foo*/.
14518 bar/*location: null*/. 14519 bar/*location: null*/.
14519 baz/*location: null*/() 14520 baz/*location: null*/()
14520 class C { 14521 class C {
14521 } 14522 }
14522 '''); 14523 ''');
14523 } 14524 }
14524 } 14525 }
14525 14526
14526 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() { 14527 test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() {
14527 var library = checkLibrary( 14528 var library = checkLibrary(
14528 'import "dart:async" as foo; @foo.Future.bar() class C {}', 14529 'import "dart:async" as foo; @foo.Future.bar() class C {}',
14529 allowErrors: true); 14530 allowErrors: true);
14530 if (isStrongMode) { 14531 if (isStrongMode) {
14531 checkElementText( 14532 checkElementText(
14532 library, 14533 library,
14533 r''' 14534 r'''
14534 import 'dart:async' as foo; 14535 import 'dart:async' as foo;
14535 @ 14536 @
14536 foo/*location: null*/. 14537 foo/*location: test.dart;foo*/.
14537 Future/*location: dart:async;Future*/. 14538 Future/*location: dart:async;Future*/.
14538 bar/*location: null*/() 14539 bar/*location: null*/()
14539 class C { 14540 class C {
14540 } 14541 }
14541 '''); 14542 ''');
14542 } else { 14543 } else {
14543 checkElementText( 14544 checkElementText(
14544 library, 14545 library,
14545 r''' 14546 r'''
14546 import 'dart:async' as foo; 14547 import 'dart:async' as foo;
14547 @ 14548 @
14548 foo/*location: null*/. 14549 foo/*location: test.dart;foo*/.
14549 Future/*location: dart:async;Future*/. 14550 Future/*location: dart:async;Future*/.
14550 bar/*location: null*/() 14551 bar/*location: null*/()
14551 class C { 14552 class C {
14552 } 14553 }
14553 '''); 14554 ''');
14554 } 14555 }
14555 } 14556 }
14556 14557
14557 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() { 14558 test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() {
14558 var library = checkLibrary('@foo.bar() class C {}', allowErrors: true); 14559 var library = checkLibrary('@foo.bar() class C {}', allowErrors: true);
(...skipping 23 matching lines...) Expand all
14582 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() { 14583 test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() {
14583 var library = checkLibrary( 14584 var library = checkLibrary(
14584 'import "dart:async" as foo; @foo.bar() class C {}', 14585 'import "dart:async" as foo; @foo.bar() class C {}',
14585 allowErrors: true); 14586 allowErrors: true);
14586 if (isStrongMode) { 14587 if (isStrongMode) {
14587 checkElementText( 14588 checkElementText(
14588 library, 14589 library,
14589 r''' 14590 r'''
14590 import 'dart:async' as foo; 14591 import 'dart:async' as foo;
14591 @ 14592 @
14592 foo/*location: null*/. 14593 foo/*location: test.dart;foo*/.
14593 bar/*location: null*/() 14594 bar/*location: null*/()
14594 class C { 14595 class C {
14595 } 14596 }
14596 '''); 14597 ''');
14597 } else { 14598 } else {
14598 checkElementText( 14599 checkElementText(
14599 library, 14600 library,
14600 r''' 14601 r'''
14601 import 'dart:async' as foo; 14602 import 'dart:async' as foo;
14602 @ 14603 @
14603 foo/*location: null*/. 14604 foo/*location: test.dart;foo*/.
14604 bar/*location: null*/() 14605 bar/*location: null*/()
14605 class C { 14606 class C {
14606 } 14607 }
14607 '''); 14608 ''');
14608 } 14609 }
14609 } 14610 }
14610 14611
14611 test_unresolved_annotation_simpleIdentifier() { 14612 test_unresolved_annotation_simpleIdentifier() {
14612 var library = checkLibrary('@foo class C {}', allowErrors: true); 14613 var library = checkLibrary('@foo class C {}', allowErrors: true);
14613 if (isStrongMode) { 14614 if (isStrongMode) {
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
15191 fail('Unexpectedly tried to get unlinked summary for $uri'); 15192 fail('Unexpectedly tried to get unlinked summary for $uri');
15192 } 15193 }
15193 return serializedUnit; 15194 return serializedUnit;
15194 } 15195 }
15195 15196
15196 @override 15197 @override
15197 bool hasLibrarySummary(String uri) { 15198 bool hasLibrarySummary(String uri) {
15198 return true; 15199 return true;
15199 } 15200 }
15200 } 15201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698