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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 7 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
8 import 'package:analysis_server/src/services/completion/dart/type_member_contrib
utor.dart'; | 8 import 'package:analysis_server/src/services/completion/dart/type_member_contrib
utor.dart'; |
9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 9 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 class EE { } | 543 class EE { } |
544 class F { }'''); | 544 class F { }'''); |
545 addSource('/testG.dart', 'class G { }'); | 545 addSource('/testG.dart', 'class G { }'); |
546 addSource( | 546 addSource( |
547 '/testH.dart', | 547 '/testH.dart', |
548 ''' | 548 ''' |
549 class H { } | 549 class H { } |
550 int T3; | 550 int T3; |
551 var _T4;'''); // not imported | 551 var _T4;'''); // not imported |
552 addTestSource(''' | 552 addTestSource(''' |
553 import "/testAB.dart"; | 553 import "testAB.dart"; |
554 import "/testCD.dart" hide D; | 554 import "testCD.dart" hide D; |
555 import "/testEEF.dart" show EE; | 555 import "testEEF.dart" show EE; |
556 import "/testG.dart" as g; | 556 import "testG.dart" as g; |
557 int T5; | 557 int T5; |
558 var _T6; | 558 var _T6; |
559 String get T7 => 'hello'; | 559 String get T7 => 'hello'; |
560 set T8(int value) { partT8() {} } | 560 set T8(int value) { partT8() {} } |
561 Z D2() {int x;} | 561 Z D2() {int x;} |
562 class X { | 562 class X { |
563 int get clog => 8; | 563 int get clog => 8; |
564 set blog(value) { } | 564 set blog(value) { } |
565 a() { | 565 a() { |
566 var f; | 566 var f; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 class EE { } | 643 class EE { } |
644 class F { }'''); | 644 class F { }'''); |
645 addSource('/testG.dart', 'class G { }'); | 645 addSource('/testG.dart', 'class G { }'); |
646 addSource( | 646 addSource( |
647 '/testH.dart', | 647 '/testH.dart', |
648 ''' | 648 ''' |
649 class H { } | 649 class H { } |
650 int T3; | 650 int T3; |
651 var _T4;'''); // not imported | 651 var _T4;'''); // not imported |
652 addTestSource(''' | 652 addTestSource(''' |
653 import "/testAB.dart"; | 653 import "testAB.dart"; |
654 import "/testCD.dart" hide D; | 654 import "testCD.dart" hide D; |
655 import "/testEEF.dart" show EE; | 655 import "testEEF.dart" show EE; |
656 import "/testG.dart" as g; | 656 import "testG.dart" as g; |
657 int T5; | 657 int T5; |
658 var _T6; | 658 var _T6; |
659 String get T7 => 'hello'; | 659 String get T7 => 'hello'; |
660 set T8(int value) { partT8() {} } | 660 set T8(int value) { partT8() {} } |
661 Z D2() {int x;} | 661 Z D2() {int x;} |
662 class X { | 662 class X { |
663 int get clog => 8; | 663 int get clog => 8; |
664 set blog(value) { } | 664 set blog(value) { } |
665 a() { | 665 a() { |
666 var f; | 666 var f; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 class EE { } | 763 class EE { } |
764 class F { }'''); | 764 class F { }'''); |
765 addSource('/testG.dart', 'class G { }'); | 765 addSource('/testG.dart', 'class G { }'); |
766 addSource( | 766 addSource( |
767 '/testH.dart', | 767 '/testH.dart', |
768 ''' | 768 ''' |
769 class H { } | 769 class H { } |
770 int T3; | 770 int T3; |
771 var _T4;'''); // not imported | 771 var _T4;'''); // not imported |
772 addTestSource(''' | 772 addTestSource(''' |
773 import "/testAB.dart"; | 773 import "testAB.dart"; |
774 import "/testCD.dart" hide D; | 774 import "testCD.dart" hide D; |
775 import "/testEEF.dart" show EE; | 775 import "testEEF.dart" show EE; |
776 import "/testG.dart" as g; | 776 import "testG.dart" as g; |
777 int T5; | 777 int T5; |
778 var _T6; | 778 var _T6; |
779 String get T7 => 'hello'; | 779 String get T7 => 'hello'; |
780 set T8(int value) { partT8() {} } | 780 set T8(int value) { partT8() {} } |
781 Z D2() {int x;} | 781 Z D2() {int x;} |
782 class X { | 782 class X { |
783 int get clog => 8; | 783 int get clog => 8; |
784 set blog(value) { } | 784 set blog(value) { } |
785 a() { | 785 a() { |
786 final ^ | 786 final ^ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 class EE { } | 869 class EE { } |
870 class F { }'''); | 870 class F { }'''); |
871 addSource('/testG.dart', 'class G { }'); | 871 addSource('/testG.dart', 'class G { }'); |
872 addSource( | 872 addSource( |
873 '/testH.dart', | 873 '/testH.dart', |
874 ''' | 874 ''' |
875 class H { } | 875 class H { } |
876 int T3; | 876 int T3; |
877 var _T4;'''); // not imported | 877 var _T4;'''); // not imported |
878 addTestSource(''' | 878 addTestSource(''' |
879 import "/testAB.dart"; | 879 import "testAB.dart"; |
880 import "/testCD.dart" hide D; | 880 import "testCD.dart" hide D; |
881 import "/testEEF.dart" show EE; | 881 import "testEEF.dart" show EE; |
882 import "/testG.dart" as g; | 882 import "testG.dart" as g; |
883 int T5; | 883 int T5; |
884 var _T6; | 884 var _T6; |
885 String get T7 => 'hello'; | 885 String get T7 => 'hello'; |
886 set T8(int value) { partT8() {} } | 886 set T8(int value) { partT8() {} } |
887 Z D2() {int x;} | 887 Z D2() {int x;} |
888 class X { | 888 class X { |
889 int get clog => 8; | 889 int get clog => 8; |
890 set blog(value) { } | 890 set blog(value) { } |
891 a() { | 891 a() { |
892 final ^ | 892 final ^ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 class F { }'''); | 975 class F { }'''); |
976 addSource('/testG.dart', 'class G { }'); | 976 addSource('/testG.dart', 'class G { }'); |
977 addSource( | 977 addSource( |
978 '/testH.dart', | 978 '/testH.dart', |
979 ''' | 979 ''' |
980 class H { } | 980 class H { } |
981 class D3 { } | 981 class D3 { } |
982 int T3; | 982 int T3; |
983 var _T4;'''); // not imported | 983 var _T4;'''); // not imported |
984 addTestSource(''' | 984 addTestSource(''' |
985 import "/testAB.dart"; | 985 import "testAB.dart"; |
986 import "/testCD.dart" hide D; | 986 import "testCD.dart" hide D; |
987 import "/testEEF.dart" show EE; | 987 import "testEEF.dart" show EE; |
988 import "/testG.dart" as g; | 988 import "testG.dart" as g; |
989 int T5; | 989 int T5; |
990 var _T6; | 990 var _T6; |
991 Z D2() {int x;} | 991 Z D2() {int x;} |
992 class X {a() {var f; {var x;} D^ var r;} void b() { }} | 992 class X {a() {var f; {var x;} D^ var r;} void b() { }} |
993 class Z { }'''); | 993 class Z { }'''); |
994 await computeSuggestions(); | 994 await computeSuggestions(); |
995 | 995 |
996 expect(replacementOffset, completionOffset - 1); | 996 expect(replacementOffset, completionOffset - 1); |
997 expect(replacementLength, 1); | 997 expect(replacementLength, 1); |
998 | 998 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | 1043 // Block BlockFunctionBody MethodDeclaration ClassDeclaration |
1044 addSource( | 1044 addSource( |
1045 '/testB.dart', | 1045 '/testB.dart', |
1046 ''' | 1046 ''' |
1047 lib B; | 1047 lib B; |
1048 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } | 1048 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } |
1049 class E extends F { var e1; e2() { } } | 1049 class E extends F { var e1; e2() { } } |
1050 class I { int i1; i2() { } } | 1050 class I { int i1; i2() { } } |
1051 class M { var m1; int m2() { } }'''); | 1051 class M { var m1; int m2() { } }'''); |
1052 addTestSource(''' | 1052 addTestSource(''' |
1053 import "/testB.dart"; | 1053 import "testB.dart"; |
1054 class A extends E implements I with M {a() {^}}'''); | 1054 class A extends E implements I with M {a() {^}}'''); |
1055 await computeSuggestions(); | 1055 await computeSuggestions(); |
1056 | 1056 |
1057 expect(replacementOffset, completionOffset); | 1057 expect(replacementOffset, completionOffset); |
1058 expect(replacementLength, 0); | 1058 expect(replacementLength, 0); |
1059 // TODO (danrubel) prefer fields over getters | 1059 // TODO (danrubel) prefer fields over getters |
1060 // If add `get e1;` to interface I | 1060 // If add `get e1;` to interface I |
1061 // then suggestions include getter e1 rather than field e1 | 1061 // then suggestions include getter e1 rather than field e1 |
1062 assertNotSuggested('e1'); | 1062 assertNotSuggested('e1'); |
1063 assertNotSuggested('f1'); | 1063 assertNotSuggested('f1'); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 class EE { } | 1116 class EE { } |
1117 class F { }'''); | 1117 class F { }'''); |
1118 addSource('/testG.dart', 'class G { }'); | 1118 addSource('/testG.dart', 'class G { }'); |
1119 addSource( | 1119 addSource( |
1120 '/testH.dart', | 1120 '/testH.dart', |
1121 ''' | 1121 ''' |
1122 class H { } | 1122 class H { } |
1123 int T3; | 1123 int T3; |
1124 var _T4;'''); // not imported | 1124 var _T4;'''); // not imported |
1125 addTestSource(''' | 1125 addTestSource(''' |
1126 import "/testAB.dart"; | 1126 import "testAB.dart"; |
1127 import "/testCD.dart" hide D; | 1127 import "testCD.dart" hide D; |
1128 import "/testEEF.dart" show EE; | 1128 import "testEEF.dart" show EE; |
1129 import "/testG.dart" as g; | 1129 import "testG.dart" as g; |
1130 int T5; | 1130 int T5; |
1131 var _T6; | 1131 var _T6; |
1132 String get T7 => 'hello'; | 1132 String get T7 => 'hello'; |
1133 set T8(int value) { partT8() {} } | 1133 set T8(int value) { partT8() {} } |
1134 Z D2() {int x;} | 1134 Z D2() {int x;} |
1135 class X { | 1135 class X { |
1136 int get clog => 8; | 1136 int get clog => 8; |
1137 set blog(value) { } | 1137 set blog(value) { } |
1138 a() { | 1138 a() { |
1139 var f; | 1139 var f; |
1140 localF(int arg1) { } | 1140 localF(int arg1) { } |
1141 {var x;} | 1141 {var x;} |
1142 p^ var r; | 1142 p^ var r; |
1143 } | 1143 } |
1144 void b() { }} | 1144 void b() { }} |
1145 class Z { }'''); | 1145 class Z { }'''); |
1146 await computeSuggestions(); | 1146 await computeSuggestions(); |
1147 expect(replacementOffset, completionOffset - 1); | 1147 expect(replacementOffset, completionOffset - 1); |
1148 expect(replacementLength, 1); | 1148 expect(replacementLength, 1); |
1149 assertNotSuggested('partT8'); | 1149 assertNotSuggested('partT8'); |
1150 assertNotSuggested('partBoo'); | 1150 assertNotSuggested('partBoo'); |
1151 assertNotSuggested('parseIPv6Address'); | 1151 assertNotSuggested('parseIPv6Address'); |
1152 assertNotSuggested('parseHex'); | 1152 assertNotSuggested('parseHex'); |
1153 } | 1153 } |
1154 | 1154 |
1155 test_Block_unimported() async { | 1155 test_Block_unimported() async { |
1156 addPackageSource('myBar', 'bar.dart', 'class Foo2 { Foo2() { } }'); | 1156 addPackageSource('myBar', 'bar.dart', 'class Foo2 { Foo2() { } }'); |
1157 addSource( | 1157 addSource( |
1158 '/proj/testAB.dart', 'import "package:myBar/bar.dart"; class Foo { }'); | 1158 '/proj/testAB.dart', 'import "package:myBar/bar.dart"; class Foo { }'); |
1159 testFile = '/proj/completionTest.dart'; | 1159 testFile = provider.convertPath('/proj/completionTest.dart'); |
1160 addTestSource('class C {foo(){F^}}'); | 1160 addTestSource('class C {foo(){F^}}'); |
1161 await computeSuggestions(); | 1161 await computeSuggestions(); |
1162 expect(replacementOffset, completionOffset - 1); | 1162 expect(replacementOffset, completionOffset - 1); |
1163 expect(replacementLength, 1); | 1163 expect(replacementLength, 1); |
1164 assertNotSuggested('Foo'); | 1164 assertNotSuggested('Foo'); |
1165 // TODO(danrubel) implement | 1165 // TODO(danrubel) implement |
1166 assertNotSuggested('Foo2'); | 1166 assertNotSuggested('Foo2'); |
1167 assertNotSuggested('Future'); | 1167 assertNotSuggested('Future'); |
1168 } | 1168 } |
1169 | 1169 |
1170 test_CascadeExpression_method1() async { | 1170 test_CascadeExpression_method1() async { |
1171 // PropertyAccess CascadeExpression ExpressionStatement Block | 1171 // PropertyAccess CascadeExpression ExpressionStatement Block |
1172 addSource( | 1172 addSource( |
1173 '/testB.dart', | 1173 '/testB.dart', |
1174 ''' | 1174 ''' |
1175 class B { }'''); | 1175 class B { }'''); |
1176 addTestSource(''' | 1176 addTestSource(''' |
1177 import "/testB.dart"; | 1177 import "testB.dart"; |
1178 class A {var b; X _c;} | 1178 class A {var b; X _c;} |
1179 class X{} | 1179 class X{} |
1180 // looks like a cascade to the parser | 1180 // looks like a cascade to the parser |
1181 // but the user is trying to get completions for a non-cascade | 1181 // but the user is trying to get completions for a non-cascade |
1182 main() {A a; a.^.z()}'''); | 1182 main() {A a; a.^.z()}'''); |
1183 await computeSuggestions(); | 1183 await computeSuggestions(); |
1184 expect(replacementOffset, completionOffset); | 1184 expect(replacementOffset, completionOffset); |
1185 expect(replacementLength, 0); | 1185 expect(replacementLength, 0); |
1186 assertSuggestField('b', null); | 1186 assertSuggestField('b', null); |
1187 assertSuggestField('_c', 'X'); | 1187 assertSuggestField('_c', 'X'); |
1188 assertNotSuggested('Object'); | 1188 assertNotSuggested('Object'); |
1189 assertNotSuggested('A'); | 1189 assertNotSuggested('A'); |
1190 assertNotSuggested('B'); | 1190 assertNotSuggested('B'); |
1191 assertNotSuggested('X'); | 1191 assertNotSuggested('X'); |
1192 assertNotSuggested('z'); | 1192 assertNotSuggested('z'); |
1193 assertNotSuggested('=='); | 1193 assertNotSuggested('=='); |
1194 } | 1194 } |
1195 | 1195 |
1196 test_CascadeExpression_selector1() async { | 1196 test_CascadeExpression_selector1() async { |
1197 // PropertyAccess CascadeExpression ExpressionStatement Block | 1197 // PropertyAccess CascadeExpression ExpressionStatement Block |
1198 addSource( | 1198 addSource( |
1199 '/testB.dart', | 1199 '/testB.dart', |
1200 ''' | 1200 ''' |
1201 class B { }'''); | 1201 class B { }'''); |
1202 addTestSource(''' | 1202 addTestSource(''' |
1203 import "/testB.dart"; | 1203 import "testB.dart"; |
1204 class A {var b; X _c;} | 1204 class A {var b; X _c;} |
1205 class X{} | 1205 class X{} |
1206 // looks like a cascade to the parser | 1206 // looks like a cascade to the parser |
1207 // but the user is trying to get completions for a non-cascade | 1207 // but the user is trying to get completions for a non-cascade |
1208 main() {A a; a.^.z}'''); | 1208 main() {A a; a.^.z}'''); |
1209 await computeSuggestions(); | 1209 await computeSuggestions(); |
1210 expect(replacementOffset, completionOffset); | 1210 expect(replacementOffset, completionOffset); |
1211 expect(replacementLength, 0); | 1211 expect(replacementLength, 0); |
1212 assertSuggestField('b', null); | 1212 assertSuggestField('b', null); |
1213 assertSuggestField('_c', 'X'); | 1213 assertSuggestField('_c', 'X'); |
1214 assertNotSuggested('Object'); | 1214 assertNotSuggested('Object'); |
1215 assertNotSuggested('A'); | 1215 assertNotSuggested('A'); |
1216 assertNotSuggested('B'); | 1216 assertNotSuggested('B'); |
1217 assertNotSuggested('X'); | 1217 assertNotSuggested('X'); |
1218 assertNotSuggested('z'); | 1218 assertNotSuggested('z'); |
1219 assertNotSuggested('=='); | 1219 assertNotSuggested('=='); |
1220 } | 1220 } |
1221 | 1221 |
1222 test_CascadeExpression_selector2() async { | 1222 test_CascadeExpression_selector2() async { |
1223 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement | 1223 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement |
1224 addSource( | 1224 addSource( |
1225 '/testB.dart', | 1225 '/testB.dart', |
1226 ''' | 1226 ''' |
1227 class B { }'''); | 1227 class B { }'''); |
1228 addTestSource(''' | 1228 addTestSource(''' |
1229 import "/testB.dart"; | 1229 import "testB.dart"; |
1230 class A {var b; X _c;} | 1230 class A {var b; X _c;} |
1231 class X{} | 1231 class X{} |
1232 main() {A a; a..^z}'''); | 1232 main() {A a; a..^z}'''); |
1233 await computeSuggestions(); | 1233 await computeSuggestions(); |
1234 expect(replacementOffset, completionOffset); | 1234 expect(replacementOffset, completionOffset); |
1235 expect(replacementLength, 1); | 1235 expect(replacementLength, 1); |
1236 assertSuggestField('b', null); | 1236 assertSuggestField('b', null); |
1237 assertSuggestField('_c', 'X'); | 1237 assertSuggestField('_c', 'X'); |
1238 assertNotSuggested('Object'); | 1238 assertNotSuggested('Object'); |
1239 assertNotSuggested('A'); | 1239 assertNotSuggested('A'); |
1240 assertNotSuggested('B'); | 1240 assertNotSuggested('B'); |
1241 assertNotSuggested('X'); | 1241 assertNotSuggested('X'); |
1242 assertNotSuggested('z'); | 1242 assertNotSuggested('z'); |
1243 assertNotSuggested('=='); | 1243 assertNotSuggested('=='); |
1244 } | 1244 } |
1245 | 1245 |
1246 test_CascadeExpression_selector2_withTrailingReturn() async { | 1246 test_CascadeExpression_selector2_withTrailingReturn() async { |
1247 // PropertyAccess CascadeExpression ExpressionStatement Block | 1247 // PropertyAccess CascadeExpression ExpressionStatement Block |
1248 addSource( | 1248 addSource( |
1249 '/testB.dart', | 1249 '/testB.dart', |
1250 ''' | 1250 ''' |
1251 class B { }'''); | 1251 class B { }'''); |
1252 addTestSource(''' | 1252 addTestSource(''' |
1253 import "/testB.dart"; | 1253 import "testB.dart"; |
1254 class A {var b; X _c;} | 1254 class A {var b; X _c;} |
1255 class X{} | 1255 class X{} |
1256 main() {A a; a..^ return}'''); | 1256 main() {A a; a..^ return}'''); |
1257 await computeSuggestions(); | 1257 await computeSuggestions(); |
1258 expect(replacementOffset, completionOffset); | 1258 expect(replacementOffset, completionOffset); |
1259 expect(replacementLength, 0); | 1259 expect(replacementLength, 0); |
1260 assertSuggestField('b', null); | 1260 assertSuggestField('b', null); |
1261 assertSuggestField('_c', 'X'); | 1261 assertSuggestField('_c', 'X'); |
1262 assertNotSuggested('Object'); | 1262 assertNotSuggested('Object'); |
1263 assertNotSuggested('A'); | 1263 assertNotSuggested('A'); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 part of libAB; | 1475 part of libAB; |
1476 var T1; | 1476 var T1; |
1477 PB F1() => new PB(); | 1477 PB F1() => new PB(); |
1478 class PB { }'''); | 1478 class PB { }'''); |
1479 addSource( | 1479 addSource( |
1480 '/testCD.dart', | 1480 '/testCD.dart', |
1481 ''' | 1481 ''' |
1482 class C { } | 1482 class C { } |
1483 class D { }'''); | 1483 class D { }'''); |
1484 addTestSource(''' | 1484 addTestSource(''' |
1485 import "/testAB.dart" hide ^; | 1485 import "testAB.dart" hide ^; |
1486 import "/testCD.dart"; | 1486 import "testCD.dart"; |
1487 class X {}'''); | 1487 class X {}'''); |
1488 await computeSuggestions(); | 1488 await computeSuggestions(); |
1489 assertNoSuggestions(); | 1489 assertNoSuggestions(); |
1490 } | 1490 } |
1491 | 1491 |
1492 test_Combinator_show() async { | 1492 test_Combinator_show() async { |
1493 // SimpleIdentifier HideCombinator ImportDirective | 1493 // SimpleIdentifier HideCombinator ImportDirective |
1494 addSource( | 1494 addSource( |
1495 '/testAB.dart', | 1495 '/testAB.dart', |
1496 ''' | 1496 ''' |
1497 library libAB; | 1497 library libAB; |
1498 part '/partAB.dart'; | 1498 part '/partAB.dart'; |
1499 class A { } | 1499 class A { } |
1500 class B { }'''); | 1500 class B { }'''); |
1501 addSource( | 1501 addSource( |
1502 '/partAB.dart', | 1502 '/partAB.dart', |
1503 ''' | 1503 ''' |
1504 part of libAB; | 1504 part of libAB; |
1505 var T1; | 1505 var T1; |
1506 PB F1() => new PB(); | 1506 PB F1() => new PB(); |
1507 typedef PB2 F2(int blat); | 1507 typedef PB2 F2(int blat); |
1508 class Clz = Object with Object; | 1508 class Clz = Object with Object; |
1509 class PB { }'''); | 1509 class PB { }'''); |
1510 addSource( | 1510 addSource( |
1511 '/testCD.dart', | 1511 '/testCD.dart', |
1512 ''' | 1512 ''' |
1513 class C { } | 1513 class C { } |
1514 class D { }'''); | 1514 class D { }'''); |
1515 addTestSource(''' | 1515 addTestSource(''' |
1516 import "/testAB.dart" show ^; | 1516 import "testAB.dart" show ^; |
1517 import "/testCD.dart"; | 1517 import "testCD.dart"; |
1518 class X {}'''); | 1518 class X {}'''); |
1519 await computeSuggestions(); | 1519 await computeSuggestions(); |
1520 assertNoSuggestions(); | 1520 assertNoSuggestions(); |
1521 } | 1521 } |
1522 | 1522 |
1523 test_ConditionalExpression_elseExpression() async { | 1523 test_ConditionalExpression_elseExpression() async { |
1524 // SimpleIdentifier ConditionalExpression ReturnStatement | 1524 // SimpleIdentifier ConditionalExpression ReturnStatement |
1525 addSource( | 1525 addSource( |
1526 '/testA.dart', | 1526 '/testA.dart', |
1527 ''' | 1527 ''' |
1528 int T1; | 1528 int T1; |
1529 F1() { } | 1529 F1() { } |
1530 class A {int x;}'''); | 1530 class A {int x;}'''); |
1531 addTestSource(''' | 1531 addTestSource(''' |
1532 import "/testA.dart"; | 1532 import "testA.dart"; |
1533 int T2; | 1533 int T2; |
1534 F2() { } | 1534 F2() { } |
1535 class B {int x;} | 1535 class B {int x;} |
1536 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); | 1536 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); |
1537 await computeSuggestions(); | 1537 await computeSuggestions(); |
1538 // top level results are partially filtered based on first char | 1538 // top level results are partially filtered based on first char |
1539 assertNotSuggested('T2'); | 1539 assertNotSuggested('T2'); |
1540 // TODO (danrubel) getter is being suggested instead of top level var | 1540 // TODO (danrubel) getter is being suggested instead of top level var |
1541 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1541 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1542 } | 1542 } |
1543 | 1543 |
1544 test_ConditionalExpression_elseExpression_empty() async { | 1544 test_ConditionalExpression_elseExpression_empty() async { |
1545 // SimpleIdentifier ConditionalExpression ReturnStatement | 1545 // SimpleIdentifier ConditionalExpression ReturnStatement |
1546 addSource( | 1546 addSource( |
1547 '/testA.dart', | 1547 '/testA.dart', |
1548 ''' | 1548 ''' |
1549 int T1; | 1549 int T1; |
1550 F1() { } | 1550 F1() { } |
1551 class A {int x;}'''); | 1551 class A {int x;}'''); |
1552 addTestSource(''' | 1552 addTestSource(''' |
1553 import "/testA.dart"; | 1553 import "testA.dart"; |
1554 int T2; | 1554 int T2; |
1555 F2() { } | 1555 F2() { } |
1556 class B {int x;} | 1556 class B {int x;} |
1557 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); | 1557 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); |
1558 await computeSuggestions(); | 1558 await computeSuggestions(); |
1559 assertNotSuggested('x'); | 1559 assertNotSuggested('x'); |
1560 assertNotSuggested('f'); | 1560 assertNotSuggested('f'); |
1561 assertNotSuggested('foo'); | 1561 assertNotSuggested('foo'); |
1562 assertNotSuggested('C'); | 1562 assertNotSuggested('C'); |
1563 assertNotSuggested('F2'); | 1563 assertNotSuggested('F2'); |
1564 assertNotSuggested('T2'); | 1564 assertNotSuggested('T2'); |
1565 assertNotSuggested('A'); | 1565 assertNotSuggested('A'); |
1566 assertNotSuggested('F1'); | 1566 assertNotSuggested('F1'); |
1567 // TODO (danrubel) getter is being suggested instead of top level var | 1567 // TODO (danrubel) getter is being suggested instead of top level var |
1568 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1568 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1569 } | 1569 } |
1570 | 1570 |
1571 test_ConditionalExpression_partial_thenExpression() async { | 1571 test_ConditionalExpression_partial_thenExpression() async { |
1572 // SimpleIdentifier ConditionalExpression ReturnStatement | 1572 // SimpleIdentifier ConditionalExpression ReturnStatement |
1573 addSource( | 1573 addSource( |
1574 '/testA.dart', | 1574 '/testA.dart', |
1575 ''' | 1575 ''' |
1576 int T1; | 1576 int T1; |
1577 F1() { } | 1577 F1() { } |
1578 class A {int x;}'''); | 1578 class A {int x;}'''); |
1579 addTestSource(''' | 1579 addTestSource(''' |
1580 import "/testA.dart"; | 1580 import "testA.dart"; |
1581 int T2; | 1581 int T2; |
1582 F2() { } | 1582 F2() { } |
1583 class B {int x;} | 1583 class B {int x;} |
1584 class C {foo(){var f; {var x;} return a ? T^}}'''); | 1584 class C {foo(){var f; {var x;} return a ? T^}}'''); |
1585 await computeSuggestions(); | 1585 await computeSuggestions(); |
1586 // top level results are partially filtered based on first char | 1586 // top level results are partially filtered based on first char |
1587 assertNotSuggested('T2'); | 1587 assertNotSuggested('T2'); |
1588 // TODO (danrubel) getter is being suggested instead of top level var | 1588 // TODO (danrubel) getter is being suggested instead of top level var |
1589 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1589 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1590 } | 1590 } |
1591 | 1591 |
1592 test_ConditionalExpression_partial_thenExpression_empty() async { | 1592 test_ConditionalExpression_partial_thenExpression_empty() async { |
1593 // SimpleIdentifier ConditionalExpression ReturnStatement | 1593 // SimpleIdentifier ConditionalExpression ReturnStatement |
1594 addSource( | 1594 addSource( |
1595 '/testA.dart', | 1595 '/testA.dart', |
1596 ''' | 1596 ''' |
1597 int T1; | 1597 int T1; |
1598 F1() { } | 1598 F1() { } |
1599 class A {int x;}'''); | 1599 class A {int x;}'''); |
1600 addTestSource(''' | 1600 addTestSource(''' |
1601 import "/testA.dart"; | 1601 import "testA.dart"; |
1602 int T2; | 1602 int T2; |
1603 F2() { } | 1603 F2() { } |
1604 class B {int x;} | 1604 class B {int x;} |
1605 class C {foo(){var f; {var x;} return a ? ^}}'''); | 1605 class C {foo(){var f; {var x;} return a ? ^}}'''); |
1606 await computeSuggestions(); | 1606 await computeSuggestions(); |
1607 assertNotSuggested('x'); | 1607 assertNotSuggested('x'); |
1608 assertNotSuggested('f'); | 1608 assertNotSuggested('f'); |
1609 assertNotSuggested('foo'); | 1609 assertNotSuggested('foo'); |
1610 assertNotSuggested('C'); | 1610 assertNotSuggested('C'); |
1611 assertNotSuggested('F2'); | 1611 assertNotSuggested('F2'); |
1612 assertNotSuggested('T2'); | 1612 assertNotSuggested('T2'); |
1613 assertNotSuggested('A'); | 1613 assertNotSuggested('A'); |
1614 assertNotSuggested('F1'); | 1614 assertNotSuggested('F1'); |
1615 // TODO (danrubel) getter is being suggested instead of top level var | 1615 // TODO (danrubel) getter is being suggested instead of top level var |
1616 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1616 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1617 } | 1617 } |
1618 | 1618 |
1619 test_ConditionalExpression_thenExpression() async { | 1619 test_ConditionalExpression_thenExpression() async { |
1620 // SimpleIdentifier ConditionalExpression ReturnStatement | 1620 // SimpleIdentifier ConditionalExpression ReturnStatement |
1621 addSource( | 1621 addSource( |
1622 '/testA.dart', | 1622 '/testA.dart', |
1623 ''' | 1623 ''' |
1624 int T1; | 1624 int T1; |
1625 F1() { } | 1625 F1() { } |
1626 class A {int x;}'''); | 1626 class A {int x;}'''); |
1627 addTestSource(''' | 1627 addTestSource(''' |
1628 import "/testA.dart"; | 1628 import "testA.dart"; |
1629 int T2; | 1629 int T2; |
1630 F2() { } | 1630 F2() { } |
1631 class B {int x;} | 1631 class B {int x;} |
1632 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); | 1632 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); |
1633 await computeSuggestions(); | 1633 await computeSuggestions(); |
1634 // top level results are partially filtered based on first char | 1634 // top level results are partially filtered based on first char |
1635 assertNotSuggested('T2'); | 1635 assertNotSuggested('T2'); |
1636 // TODO (danrubel) getter is being suggested instead of top level var | 1636 // TODO (danrubel) getter is being suggested instead of top level var |
1637 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1637 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1638 } | 1638 } |
1639 | 1639 |
1640 test_ConstructorName_importedClass() async { | 1640 test_ConstructorName_importedClass() async { |
1641 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1641 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1642 // InstanceCreationExpression | 1642 // InstanceCreationExpression |
1643 addSource( | 1643 addSource( |
1644 '/testB.dart', | 1644 '/testB.dart', |
1645 ''' | 1645 ''' |
1646 lib B; | 1646 lib B; |
1647 int T1; | 1647 int T1; |
1648 F1() { } | 1648 F1() { } |
1649 class X {X.c(); X._d(); z() {}}'''); | 1649 class X {X.c(); X._d(); z() {}}'''); |
1650 addTestSource(''' | 1650 addTestSource(''' |
1651 import "/testB.dart"; | 1651 import "testB.dart"; |
1652 var m; | 1652 var m; |
1653 main() {new X.^}'''); | 1653 main() {new X.^}'''); |
1654 await computeSuggestions(); | 1654 await computeSuggestions(); |
1655 expect(replacementOffset, completionOffset); | 1655 expect(replacementOffset, completionOffset); |
1656 expect(replacementLength, 0); | 1656 expect(replacementLength, 0); |
1657 // Suggested by NamedConstructorContributor | 1657 // Suggested by NamedConstructorContributor |
1658 assertNotSuggested('c'); | 1658 assertNotSuggested('c'); |
1659 assertNotSuggested('F1'); | 1659 assertNotSuggested('F1'); |
1660 assertNotSuggested('T1'); | 1660 assertNotSuggested('T1'); |
1661 assertNotSuggested('_d'); | 1661 assertNotSuggested('_d'); |
1662 assertNotSuggested('z'); | 1662 assertNotSuggested('z'); |
1663 assertNotSuggested('m'); | 1663 assertNotSuggested('m'); |
1664 } | 1664 } |
1665 | 1665 |
1666 test_ConstructorName_importedFactory() async { | 1666 test_ConstructorName_importedFactory() async { |
1667 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1667 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1668 // InstanceCreationExpression | 1668 // InstanceCreationExpression |
1669 addSource( | 1669 addSource( |
1670 '/testB.dart', | 1670 '/testB.dart', |
1671 ''' | 1671 ''' |
1672 lib B; | 1672 lib B; |
1673 int T1; | 1673 int T1; |
1674 F1() { } | 1674 F1() { } |
1675 class X {factory X.c(); factory X._d(); z() {}}'''); | 1675 class X {factory X.c(); factory X._d(); z() {}}'''); |
1676 addTestSource(''' | 1676 addTestSource(''' |
1677 import "/testB.dart"; | 1677 import "testB.dart"; |
1678 var m; | 1678 var m; |
1679 main() {new X.^}'''); | 1679 main() {new X.^}'''); |
1680 await computeSuggestions(); | 1680 await computeSuggestions(); |
1681 expect(replacementOffset, completionOffset); | 1681 expect(replacementOffset, completionOffset); |
1682 expect(replacementLength, 0); | 1682 expect(replacementLength, 0); |
1683 // Suggested by NamedConstructorContributor | 1683 // Suggested by NamedConstructorContributor |
1684 assertNotSuggested('c'); | 1684 assertNotSuggested('c'); |
1685 assertNotSuggested('F1'); | 1685 assertNotSuggested('F1'); |
1686 assertNotSuggested('T1'); | 1686 assertNotSuggested('T1'); |
1687 assertNotSuggested('_d'); | 1687 assertNotSuggested('_d'); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 | 1828 |
1829 test_ExpressionStatement_identifier() async { | 1829 test_ExpressionStatement_identifier() async { |
1830 // SimpleIdentifier ExpressionStatement Block | 1830 // SimpleIdentifier ExpressionStatement Block |
1831 addSource( | 1831 addSource( |
1832 '/testA.dart', | 1832 '/testA.dart', |
1833 ''' | 1833 ''' |
1834 _B F1() { } | 1834 _B F1() { } |
1835 class A {int x;} | 1835 class A {int x;} |
1836 class _B { }'''); | 1836 class _B { }'''); |
1837 addTestSource(''' | 1837 addTestSource(''' |
1838 import "/testA.dart"; | 1838 import "testA.dart"; |
1839 typedef int F2(int blat); | 1839 typedef int F2(int blat); |
1840 class Clz = Object with Object; | 1840 class Clz = Object with Object; |
1841 class C {foo(){^} void bar() {}}'''); | 1841 class C {foo(){^} void bar() {}}'''); |
1842 await computeSuggestions(); | 1842 await computeSuggestions(); |
1843 expect(replacementOffset, completionOffset); | 1843 expect(replacementOffset, completionOffset); |
1844 expect(replacementLength, 0); | 1844 expect(replacementLength, 0); |
1845 assertNotSuggested('A'); | 1845 assertNotSuggested('A'); |
1846 assertNotSuggested('F1'); | 1846 assertNotSuggested('F1'); |
1847 assertNotSuggested('C'); | 1847 assertNotSuggested('C'); |
1848 assertNotSuggested('foo'); | 1848 assertNotSuggested('foo'); |
1849 assertNotSuggested('bar'); | 1849 assertNotSuggested('bar'); |
1850 assertNotSuggested('F2'); | 1850 assertNotSuggested('F2'); |
1851 assertNotSuggested('Clz'); | 1851 assertNotSuggested('Clz'); |
1852 assertNotSuggested('C'); | 1852 assertNotSuggested('C'); |
1853 assertNotSuggested('x'); | 1853 assertNotSuggested('x'); |
1854 assertNotSuggested('_B'); | 1854 assertNotSuggested('_B'); |
1855 } | 1855 } |
1856 | 1856 |
1857 test_ExpressionStatement_name() async { | 1857 test_ExpressionStatement_name() async { |
1858 // ExpressionStatement Block BlockFunctionBody MethodDeclaration | 1858 // ExpressionStatement Block BlockFunctionBody MethodDeclaration |
1859 addSource( | 1859 addSource( |
1860 '/testA.dart', | 1860 '/testA.dart', |
1861 ''' | 1861 ''' |
1862 B T1; | 1862 B T1; |
1863 class B{}'''); | 1863 class B{}'''); |
1864 addTestSource(''' | 1864 addTestSource(''' |
1865 import "/testA.dart"; | 1865 import "testA.dart"; |
1866 class C {a() {C ^}}'''); | 1866 class C {a() {C ^}}'''); |
1867 await computeSuggestions(); | 1867 await computeSuggestions(); |
1868 assertNoSuggestions(); | 1868 assertNoSuggestions(); |
1869 } | 1869 } |
1870 | 1870 |
1871 test_FieldDeclaration_name_typed() async { | 1871 test_FieldDeclaration_name_typed() async { |
1872 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 1872 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
1873 // FieldDeclaration | 1873 // FieldDeclaration |
1874 addSource('/testA.dart', 'class A { }'); | 1874 addSource('/testA.dart', 'class A { }'); |
1875 addTestSource(''' | 1875 addTestSource(''' |
1876 import "/testA.dart"; | 1876 import "testA.dart"; |
1877 class C {A ^}'''); | 1877 class C {A ^}'''); |
1878 await computeSuggestions(); | 1878 await computeSuggestions(); |
1879 assertNoSuggestions(); | 1879 assertNoSuggestions(); |
1880 } | 1880 } |
1881 | 1881 |
1882 test_FieldDeclaration_name_var() async { | 1882 test_FieldDeclaration_name_var() async { |
1883 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 1883 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
1884 // FieldDeclaration | 1884 // FieldDeclaration |
1885 addSource('/testA.dart', 'class A { }'); | 1885 addSource('/testA.dart', 'class A { }'); |
1886 addTestSource(''' | 1886 addTestSource(''' |
1887 import "/testA.dart"; | 1887 import "testA.dart"; |
1888 class C {var ^}'''); | 1888 class C {var ^}'''); |
1889 await computeSuggestions(); | 1889 await computeSuggestions(); |
1890 assertNoSuggestions(); | 1890 assertNoSuggestions(); |
1891 } | 1891 } |
1892 | 1892 |
1893 test_FieldFormalParameter_in_non_constructor() async { | 1893 test_FieldFormalParameter_in_non_constructor() async { |
1894 // SimpleIdentifer FieldFormalParameter FormalParameterList | 1894 // SimpleIdentifer FieldFormalParameter FormalParameterList |
1895 addTestSource('class A {B(this.^foo) {}}'); | 1895 addTestSource('class A {B(this.^foo) {}}'); |
1896 await computeSuggestions(); | 1896 await computeSuggestions(); |
1897 expect(replacementOffset, completionOffset); | 1897 expect(replacementOffset, completionOffset); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 test_FunctionDeclaration_returnType_afterComment() async { | 2035 test_FunctionDeclaration_returnType_afterComment() async { |
2036 // ClassDeclaration CompilationUnit | 2036 // ClassDeclaration CompilationUnit |
2037 addSource( | 2037 addSource( |
2038 '/testA.dart', | 2038 '/testA.dart', |
2039 ''' | 2039 ''' |
2040 int T1; | 2040 int T1; |
2041 F1() { } | 2041 F1() { } |
2042 typedef D1(); | 2042 typedef D1(); |
2043 class C1 {C1(this.x) { } int x;}'''); | 2043 class C1 {C1(this.x) { } int x;}'''); |
2044 addTestSource(''' | 2044 addTestSource(''' |
2045 import "/testA.dart"; | 2045 import "testA.dart"; |
2046 int T2; | 2046 int T2; |
2047 F2() { } | 2047 F2() { } |
2048 typedef D2(); | 2048 typedef D2(); |
2049 class C2 { } | 2049 class C2 { } |
2050 /* */ ^ zoo(z) { } String name;'''); | 2050 /* */ ^ zoo(z) { } String name;'''); |
2051 await computeSuggestions(); | 2051 await computeSuggestions(); |
2052 expect(replacementOffset, completionOffset); | 2052 expect(replacementOffset, completionOffset); |
2053 expect(replacementLength, 0); | 2053 expect(replacementLength, 0); |
2054 assertNotSuggested('Object'); | 2054 assertNotSuggested('Object'); |
2055 assertNotSuggested('T1'); | 2055 assertNotSuggested('T1'); |
(...skipping 10 matching lines...) Expand all Loading... |
2066 test_FunctionDeclaration_returnType_afterComment2() async { | 2066 test_FunctionDeclaration_returnType_afterComment2() async { |
2067 // FunctionDeclaration ClassDeclaration CompilationUnit | 2067 // FunctionDeclaration ClassDeclaration CompilationUnit |
2068 addSource( | 2068 addSource( |
2069 '/testA.dart', | 2069 '/testA.dart', |
2070 ''' | 2070 ''' |
2071 int T1; | 2071 int T1; |
2072 F1() { } | 2072 F1() { } |
2073 typedef D1(); | 2073 typedef D1(); |
2074 class C1 {C1(this.x) { } int x;}'''); | 2074 class C1 {C1(this.x) { } int x;}'''); |
2075 addTestSource(''' | 2075 addTestSource(''' |
2076 import "/testA.dart"; | 2076 import "testA.dart"; |
2077 int T2; | 2077 int T2; |
2078 F2() { } | 2078 F2() { } |
2079 typedef D2(); | 2079 typedef D2(); |
2080 class C2 { } | 2080 class C2 { } |
2081 /** */ ^ zoo(z) { } String name;'''); | 2081 /** */ ^ zoo(z) { } String name;'''); |
2082 await computeSuggestions(); | 2082 await computeSuggestions(); |
2083 expect(replacementOffset, completionOffset); | 2083 expect(replacementOffset, completionOffset); |
2084 expect(replacementLength, 0); | 2084 expect(replacementLength, 0); |
2085 assertNotSuggested('Object'); | 2085 assertNotSuggested('Object'); |
2086 assertNotSuggested('T1'); | 2086 assertNotSuggested('T1'); |
(...skipping 10 matching lines...) Expand all Loading... |
2097 test_FunctionDeclaration_returnType_afterComment3() async { | 2097 test_FunctionDeclaration_returnType_afterComment3() async { |
2098 // FunctionDeclaration ClassDeclaration CompilationUnit | 2098 // FunctionDeclaration ClassDeclaration CompilationUnit |
2099 addSource( | 2099 addSource( |
2100 '/testA.dart', | 2100 '/testA.dart', |
2101 ''' | 2101 ''' |
2102 int T1; | 2102 int T1; |
2103 F1() { } | 2103 F1() { } |
2104 typedef D1(); | 2104 typedef D1(); |
2105 class C1 {C1(this.x) { } int x;}'''); | 2105 class C1 {C1(this.x) { } int x;}'''); |
2106 addTestSource(''' | 2106 addTestSource(''' |
2107 import "/testA.dart"; | 2107 import "testA.dart"; |
2108 int T2; | 2108 int T2; |
2109 F2() { } | 2109 F2() { } |
2110 typedef D2(); | 2110 typedef D2(); |
2111 /// some dartdoc | 2111 /// some dartdoc |
2112 class C2 { } | 2112 class C2 { } |
2113 ^ zoo(z) { } String name;'''); | 2113 ^ zoo(z) { } String name;'''); |
2114 await computeSuggestions(); | 2114 await computeSuggestions(); |
2115 expect(replacementOffset, completionOffset); | 2115 expect(replacementOffset, completionOffset); |
2116 expect(replacementLength, 0); | 2116 expect(replacementLength, 0); |
2117 assertNotSuggested('Object'); | 2117 assertNotSuggested('Object'); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 | 2267 |
2268 test_IndexExpression() async { | 2268 test_IndexExpression() async { |
2269 // ExpressionStatement Block | 2269 // ExpressionStatement Block |
2270 addSource( | 2270 addSource( |
2271 '/testA.dart', | 2271 '/testA.dart', |
2272 ''' | 2272 ''' |
2273 int T1; | 2273 int T1; |
2274 F1() { } | 2274 F1() { } |
2275 class A {int x;}'''); | 2275 class A {int x;}'''); |
2276 addTestSource(''' | 2276 addTestSource(''' |
2277 import "/testA.dart"; | 2277 import "testA.dart"; |
2278 int T2; | 2278 int T2; |
2279 F2() { } | 2279 F2() { } |
2280 class B {int x;} | 2280 class B {int x;} |
2281 class C {foo(){var f; {var x;} f[^]}}'''); | 2281 class C {foo(){var f; {var x;} f[^]}}'''); |
2282 await computeSuggestions(); | 2282 await computeSuggestions(); |
2283 assertNotSuggested('x'); | 2283 assertNotSuggested('x'); |
2284 assertNotSuggested('f'); | 2284 assertNotSuggested('f'); |
2285 assertNotSuggested('foo'); | 2285 assertNotSuggested('foo'); |
2286 assertNotSuggested('C'); | 2286 assertNotSuggested('C'); |
2287 assertNotSuggested('F2'); | 2287 assertNotSuggested('F2'); |
2288 assertNotSuggested('T2'); | 2288 assertNotSuggested('T2'); |
2289 assertNotSuggested('A'); | 2289 assertNotSuggested('A'); |
2290 assertNotSuggested('F1'); | 2290 assertNotSuggested('F1'); |
2291 // TODO (danrubel) getter is being suggested instead of top level var | 2291 // TODO (danrubel) getter is being suggested instead of top level var |
2292 //assertSuggestImportedTopLevelVar('T1', 'int'); | 2292 //assertSuggestImportedTopLevelVar('T1', 'int'); |
2293 } | 2293 } |
2294 | 2294 |
2295 test_IndexExpression2() async { | 2295 test_IndexExpression2() async { |
2296 // SimpleIdentifier IndexExpression ExpressionStatement Block | 2296 // SimpleIdentifier IndexExpression ExpressionStatement Block |
2297 addSource( | 2297 addSource( |
2298 '/testA.dart', | 2298 '/testA.dart', |
2299 ''' | 2299 ''' |
2300 int T1; | 2300 int T1; |
2301 F1() { } | 2301 F1() { } |
2302 class A {int x;}'''); | 2302 class A {int x;}'''); |
2303 addTestSource(''' | 2303 addTestSource(''' |
2304 import "/testA.dart"; | 2304 import "testA.dart"; |
2305 int T2; | 2305 int T2; |
2306 F2() { } | 2306 F2() { } |
2307 class B {int x;} | 2307 class B {int x;} |
2308 class C {foo(){var f; {var x;} f[T^]}}'''); | 2308 class C {foo(){var f; {var x;} f[T^]}}'''); |
2309 await computeSuggestions(); | 2309 await computeSuggestions(); |
2310 // top level results are partially filtered based on first char | 2310 // top level results are partially filtered based on first char |
2311 assertNotSuggested('T2'); | 2311 assertNotSuggested('T2'); |
2312 // TODO (danrubel) getter is being suggested instead of top level var | 2312 // TODO (danrubel) getter is being suggested instead of top level var |
2313 //assertSuggestImportedTopLevelVar('T1', 'int'); | 2313 //assertSuggestImportedTopLevelVar('T1', 'int'); |
2314 } | 2314 } |
2315 | 2315 |
2316 test_InstanceCreationExpression_imported() async { | 2316 test_InstanceCreationExpression_imported() async { |
2317 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression | 2317 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
2318 addSource( | 2318 addSource( |
2319 '/testA.dart', | 2319 '/testA.dart', |
2320 ''' | 2320 ''' |
2321 int T1; | 2321 int T1; |
2322 F1() { } | 2322 F1() { } |
2323 class A {A(this.x) { } int x;}'''); | 2323 class A {A(this.x) { } int x;}'''); |
2324 addTestSource(''' | 2324 addTestSource(''' |
2325 import "/testA.dart"; | 2325 import "testA.dart"; |
2326 import "dart:async"; | 2326 import "dart:async"; |
2327 int T2; | 2327 int T2; |
2328 F2() { } | 2328 F2() { } |
2329 class B {B(this.x, [String boo]) { } int x;} | 2329 class B {B(this.x, [String boo]) { } int x;} |
2330 class C {foo(){var f; {var x;} new ^}}'''); | 2330 class C {foo(){var f; {var x;} new ^}}'''); |
2331 await computeSuggestions(); | 2331 await computeSuggestions(); |
2332 expect(replacementOffset, completionOffset); | 2332 expect(replacementOffset, completionOffset); |
2333 expect(replacementLength, 0); | 2333 expect(replacementLength, 0); |
2334 assertNotSuggested('Object'); | 2334 assertNotSuggested('Object'); |
2335 assertNotSuggested('Future'); | 2335 assertNotSuggested('Future'); |
(...skipping 23 matching lines...) Expand all Loading... |
2359 test_InterpolationExpression() async { | 2359 test_InterpolationExpression() async { |
2360 // SimpleIdentifier InterpolationExpression StringInterpolation | 2360 // SimpleIdentifier InterpolationExpression StringInterpolation |
2361 addSource( | 2361 addSource( |
2362 '/testA.dart', | 2362 '/testA.dart', |
2363 ''' | 2363 ''' |
2364 int T1; | 2364 int T1; |
2365 F1() { } | 2365 F1() { } |
2366 typedef D1(); | 2366 typedef D1(); |
2367 class C1 {C1(this.x) { } int x;}'''); | 2367 class C1 {C1(this.x) { } int x;}'''); |
2368 addTestSource(''' | 2368 addTestSource(''' |
2369 import "/testA.dart"; | 2369 import "testA.dart"; |
2370 int T2; | 2370 int T2; |
2371 F2() { } | 2371 F2() { } |
2372 typedef D2(); | 2372 typedef D2(); |
2373 class C2 { } | 2373 class C2 { } |
2374 main() {String name; print("hello \$^");}'''); | 2374 main() {String name; print("hello \$^");}'''); |
2375 await computeSuggestions(); | 2375 await computeSuggestions(); |
2376 expect(replacementOffset, completionOffset); | 2376 expect(replacementOffset, completionOffset); |
2377 expect(replacementLength, 0); | 2377 expect(replacementLength, 0); |
2378 assertNotSuggested('Object'); | 2378 assertNotSuggested('Object'); |
2379 // TODO(danrubel) should return top level var rather than getter | 2379 // TODO(danrubel) should return top level var rather than getter |
(...skipping 10 matching lines...) Expand all Loading... |
2390 test_InterpolationExpression_block() async { | 2390 test_InterpolationExpression_block() async { |
2391 // SimpleIdentifier InterpolationExpression StringInterpolation | 2391 // SimpleIdentifier InterpolationExpression StringInterpolation |
2392 addSource( | 2392 addSource( |
2393 '/testA.dart', | 2393 '/testA.dart', |
2394 ''' | 2394 ''' |
2395 int T1; | 2395 int T1; |
2396 F1() { } | 2396 F1() { } |
2397 typedef D1(); | 2397 typedef D1(); |
2398 class C1 {C1(this.x) { } int x;}'''); | 2398 class C1 {C1(this.x) { } int x;}'''); |
2399 addTestSource(''' | 2399 addTestSource(''' |
2400 import "/testA.dart"; | 2400 import "testA.dart"; |
2401 int T2; | 2401 int T2; |
2402 F2() { } | 2402 F2() { } |
2403 typedef D2(); | 2403 typedef D2(); |
2404 class C2 { } | 2404 class C2 { } |
2405 main() {String name; print("hello \${^}");}'''); | 2405 main() {String name; print("hello \${^}");}'''); |
2406 await computeSuggestions(); | 2406 await computeSuggestions(); |
2407 expect(replacementOffset, completionOffset); | 2407 expect(replacementOffset, completionOffset); |
2408 expect(replacementLength, 0); | 2408 expect(replacementLength, 0); |
2409 assertNotSuggested('Object'); | 2409 assertNotSuggested('Object'); |
2410 assertNotSuggested('F1'); | 2410 assertNotSuggested('F1'); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 | 2457 |
2458 test_IsExpression() async { | 2458 test_IsExpression() async { |
2459 // SimpleIdentifier TypeName IsExpression IfStatement | 2459 // SimpleIdentifier TypeName IsExpression IfStatement |
2460 addSource( | 2460 addSource( |
2461 '/testB.dart', | 2461 '/testB.dart', |
2462 ''' | 2462 ''' |
2463 lib B; | 2463 lib B; |
2464 foo() { } | 2464 foo() { } |
2465 class X {X.c(); X._d(); z() {}}'''); | 2465 class X {X.c(); X._d(); z() {}}'''); |
2466 addTestSource(''' | 2466 addTestSource(''' |
2467 import "/testB.dart"; | 2467 import "testB.dart"; |
2468 class Y {Y.c(); Y._d(); z() {}} | 2468 class Y {Y.c(); Y._d(); z() {}} |
2469 main() {var x; if (x is ^) { }}'''); | 2469 main() {var x; if (x is ^) { }}'''); |
2470 await computeSuggestions(); | 2470 await computeSuggestions(); |
2471 expect(replacementOffset, completionOffset); | 2471 expect(replacementOffset, completionOffset); |
2472 expect(replacementLength, 0); | 2472 expect(replacementLength, 0); |
2473 assertNotSuggested('X'); | 2473 assertNotSuggested('X'); |
2474 assertNotSuggested('Y'); | 2474 assertNotSuggested('Y'); |
2475 assertNotSuggested('x'); | 2475 assertNotSuggested('x'); |
2476 assertNotSuggested('main'); | 2476 assertNotSuggested('main'); |
2477 assertNotSuggested('foo'); | 2477 assertNotSuggested('foo'); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 test_keyword2() async { | 2533 test_keyword2() async { |
2534 addSource( | 2534 addSource( |
2535 '/testB.dart', | 2535 '/testB.dart', |
2536 ''' | 2536 ''' |
2537 lib B; | 2537 lib B; |
2538 int newT1; | 2538 int newT1; |
2539 int T1; | 2539 int T1; |
2540 nowIsIt() { } | 2540 nowIsIt() { } |
2541 class X {factory X.c(); factory X._d(); z() {}}'''); | 2541 class X {factory X.c(); factory X._d(); z() {}}'''); |
2542 addTestSource(''' | 2542 addTestSource(''' |
2543 import "/testB.dart"; | 2543 import "testB.dart"; |
2544 String newer() {} | 2544 String newer() {} |
2545 var m; | 2545 var m; |
2546 main() {new^ X.c();}'''); | 2546 main() {new^ X.c();}'''); |
2547 await computeSuggestions(); | 2547 await computeSuggestions(); |
2548 expect(replacementOffset, completionOffset - 3); | 2548 expect(replacementOffset, completionOffset - 3); |
2549 expect(replacementLength, 3); | 2549 expect(replacementLength, 3); |
2550 assertNotSuggested('c'); | 2550 assertNotSuggested('c'); |
2551 assertNotSuggested('_d'); | 2551 assertNotSuggested('_d'); |
2552 // Imported suggestion are filtered by 1st character | 2552 // Imported suggestion are filtered by 1st character |
2553 assertNotSuggested('nowIsIt'); | 2553 assertNotSuggested('nowIsIt'); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 addTestSource('import "dart:async" deferred as bar; foo() {bar.^}'); | 2588 addTestSource('import "dart:async" deferred as bar; foo() {bar.^}'); |
2589 await computeSuggestions(); | 2589 await computeSuggestions(); |
2590 // Suggested by LibraryMemberContributor | 2590 // Suggested by LibraryMemberContributor |
2591 assertNotSuggested('Future'); | 2591 assertNotSuggested('Future'); |
2592 assertNotSuggested('loadLibrary'); | 2592 assertNotSuggested('loadLibrary'); |
2593 } | 2593 } |
2594 | 2594 |
2595 test_libraryPrefix_with_exports() async { | 2595 test_libraryPrefix_with_exports() async { |
2596 addSource('/libA.dart', 'library libA; class A { }'); | 2596 addSource('/libA.dart', 'library libA; class A { }'); |
2597 addSource('/libB.dart', 'library libB; export "/libA.dart"; class B { }'); | 2597 addSource('/libB.dart', 'library libB; export "/libA.dart"; class B { }'); |
2598 addTestSource('import "/libB.dart" as foo; main() {foo.^} class C { }'); | 2598 addTestSource('import "libB.dart" as foo; main() {foo.^} class C { }'); |
2599 await computeSuggestions(); | 2599 await computeSuggestions(); |
2600 // Suggested by LibraryMemberContributor | 2600 // Suggested by LibraryMemberContributor |
2601 assertNotSuggested('B'); | 2601 assertNotSuggested('B'); |
2602 assertNotSuggested('A'); | 2602 assertNotSuggested('A'); |
2603 } | 2603 } |
2604 | 2604 |
2605 test_Literal_list() async { | 2605 test_Literal_list() async { |
2606 // ']' ListLiteral ArgumentList MethodInvocation | 2606 // ']' ListLiteral ArgumentList MethodInvocation |
2607 addTestSource('main() {var Some; print([^]);}'); | 2607 addTestSource('main() {var Some; print([^]);}'); |
2608 await computeSuggestions(); | 2608 await computeSuggestions(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 test_MapLiteralEntry() async { | 2653 test_MapLiteralEntry() async { |
2654 // MapLiteralEntry MapLiteral VariableDeclaration | 2654 // MapLiteralEntry MapLiteral VariableDeclaration |
2655 addSource( | 2655 addSource( |
2656 '/testA.dart', | 2656 '/testA.dart', |
2657 ''' | 2657 ''' |
2658 int T1; | 2658 int T1; |
2659 F1() { } | 2659 F1() { } |
2660 typedef D1(); | 2660 typedef D1(); |
2661 class C1 {C1(this.x) { } int x;}'''); | 2661 class C1 {C1(this.x) { } int x;}'''); |
2662 addTestSource(''' | 2662 addTestSource(''' |
2663 import "/testA.dart"; | 2663 import "testA.dart"; |
2664 int T2; | 2664 int T2; |
2665 F2() { } | 2665 F2() { } |
2666 typedef D2(); | 2666 typedef D2(); |
2667 class C2 { } | 2667 class C2 { } |
2668 foo = {^'''); | 2668 foo = {^'''); |
2669 await computeSuggestions(); | 2669 await computeSuggestions(); |
2670 expect(replacementOffset, completionOffset); | 2670 expect(replacementOffset, completionOffset); |
2671 expect(replacementLength, 0); | 2671 expect(replacementLength, 0); |
2672 assertNotSuggested('Object'); | 2672 assertNotSuggested('Object'); |
2673 assertNotSuggested('F1'); | 2673 assertNotSuggested('F1'); |
2674 assertNotSuggested('D1'); | 2674 assertNotSuggested('D1'); |
2675 assertNotSuggested('C1'); | 2675 assertNotSuggested('C1'); |
2676 assertNotSuggested('T2'); | 2676 assertNotSuggested('T2'); |
2677 assertNotSuggested('F2'); | 2677 assertNotSuggested('F2'); |
2678 assertNotSuggested('D2'); | 2678 assertNotSuggested('D2'); |
2679 assertNotSuggested('C2'); | 2679 assertNotSuggested('C2'); |
2680 } | 2680 } |
2681 | 2681 |
2682 test_MapLiteralEntry1() async { | 2682 test_MapLiteralEntry1() async { |
2683 // MapLiteralEntry MapLiteral VariableDeclaration | 2683 // MapLiteralEntry MapLiteral VariableDeclaration |
2684 addSource( | 2684 addSource( |
2685 '/testA.dart', | 2685 '/testA.dart', |
2686 ''' | 2686 ''' |
2687 int T1; | 2687 int T1; |
2688 F1() { } | 2688 F1() { } |
2689 typedef D1(); | 2689 typedef D1(); |
2690 class C1 {C1(this.x) { } int x;}'''); | 2690 class C1 {C1(this.x) { } int x;}'''); |
2691 addTestSource(''' | 2691 addTestSource(''' |
2692 import "/testA.dart"; | 2692 import "testA.dart"; |
2693 int T2; | 2693 int T2; |
2694 F2() { } | 2694 F2() { } |
2695 typedef D2(); | 2695 typedef D2(); |
2696 class C2 { } | 2696 class C2 { } |
2697 foo = {T^'''); | 2697 foo = {T^'''); |
2698 await computeSuggestions(); | 2698 await computeSuggestions(); |
2699 expect(replacementOffset, completionOffset - 1); | 2699 expect(replacementOffset, completionOffset - 1); |
2700 expect(replacementLength, 1); | 2700 expect(replacementLength, 1); |
2701 assertNotSuggested('T2'); | 2701 assertNotSuggested('T2'); |
2702 } | 2702 } |
2703 | 2703 |
2704 test_MapLiteralEntry2() async { | 2704 test_MapLiteralEntry2() async { |
2705 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration | 2705 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration |
2706 addSource( | 2706 addSource( |
2707 '/testA.dart', | 2707 '/testA.dart', |
2708 ''' | 2708 ''' |
2709 int T1; | 2709 int T1; |
2710 F1() { } | 2710 F1() { } |
2711 typedef D1(); | 2711 typedef D1(); |
2712 class C1 {C1(this.x) { } int x;}'''); | 2712 class C1 {C1(this.x) { } int x;}'''); |
2713 addTestSource(''' | 2713 addTestSource(''' |
2714 import "/testA.dart"; | 2714 import "testA.dart"; |
2715 int T2; | 2715 int T2; |
2716 F2() { } | 2716 F2() { } |
2717 typedef D2(); | 2717 typedef D2(); |
2718 class C2 { } | 2718 class C2 { } |
2719 foo = {7:T^};'''); | 2719 foo = {7:T^};'''); |
2720 await computeSuggestions(); | 2720 await computeSuggestions(); |
2721 expect(replacementOffset, completionOffset - 1); | 2721 expect(replacementOffset, completionOffset - 1); |
2722 expect(replacementLength, 1); | 2722 expect(replacementLength, 1); |
2723 assertNotSuggested('T2'); | 2723 assertNotSuggested('T2'); |
2724 } | 2724 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 // Block BlockFunctionBody MethodDeclaration | 2837 // Block BlockFunctionBody MethodDeclaration |
2838 addSource( | 2838 addSource( |
2839 '/testC.dart', | 2839 '/testC.dart', |
2840 ''' | 2840 ''' |
2841 class C { | 2841 class C { |
2842 c1() {} | 2842 c1() {} |
2843 var c2; | 2843 var c2; |
2844 static c3() {} | 2844 static c3() {} |
2845 static var c4;}'''); | 2845 static var c4;}'''); |
2846 addTestSource(''' | 2846 addTestSource(''' |
2847 import "/testC.dart"; | 2847 import "testC.dart"; |
2848 class B extends C { | 2848 class B extends C { |
2849 b1() {} | 2849 b1() {} |
2850 var b2; | 2850 var b2; |
2851 static b3() {} | 2851 static b3() {} |
2852 static var b4;} | 2852 static var b4;} |
2853 class A extends B { | 2853 class A extends B { |
2854 a1() {} | 2854 a1() {} |
2855 var a2; | 2855 var a2; |
2856 static a3() {} | 2856 static a3() {} |
2857 static var a4; | 2857 static var a4; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2917 test_MethodDeclaration_returnType() async { | 2917 test_MethodDeclaration_returnType() async { |
2918 // ClassDeclaration CompilationUnit | 2918 // ClassDeclaration CompilationUnit |
2919 addSource( | 2919 addSource( |
2920 '/testA.dart', | 2920 '/testA.dart', |
2921 ''' | 2921 ''' |
2922 int T1; | 2922 int T1; |
2923 F1() { } | 2923 F1() { } |
2924 typedef D1(); | 2924 typedef D1(); |
2925 class C1 {C1(this.x) { } int x;}'''); | 2925 class C1 {C1(this.x) { } int x;}'''); |
2926 addTestSource(''' | 2926 addTestSource(''' |
2927 import "/testA.dart"; | 2927 import "testA.dart"; |
2928 int T2; | 2928 int T2; |
2929 F2() { } | 2929 F2() { } |
2930 typedef D2(); | 2930 typedef D2(); |
2931 class C2 {^ zoo(z) { } String name; }'''); | 2931 class C2 {^ zoo(z) { } String name; }'''); |
2932 await computeSuggestions(); | 2932 await computeSuggestions(); |
2933 expect(replacementOffset, completionOffset); | 2933 expect(replacementOffset, completionOffset); |
2934 expect(replacementLength, 0); | 2934 expect(replacementLength, 0); |
2935 assertNotSuggested('Object'); | 2935 assertNotSuggested('Object'); |
2936 assertNotSuggested('T1'); | 2936 assertNotSuggested('T1'); |
2937 assertNotSuggested('F1'); | 2937 assertNotSuggested('F1'); |
2938 assertNotSuggested('D1'); | 2938 assertNotSuggested('D1'); |
2939 assertNotSuggested('C1'); | 2939 assertNotSuggested('C1'); |
2940 assertNotSuggested('T2'); | 2940 assertNotSuggested('T2'); |
2941 assertNotSuggested('F2'); | 2941 assertNotSuggested('F2'); |
2942 assertNotSuggested('D2'); | 2942 assertNotSuggested('D2'); |
2943 assertNotSuggested('C2'); | 2943 assertNotSuggested('C2'); |
2944 assertNotSuggested('name'); | 2944 assertNotSuggested('name'); |
2945 } | 2945 } |
2946 | 2946 |
2947 test_MethodDeclaration_returnType_afterComment() async { | 2947 test_MethodDeclaration_returnType_afterComment() async { |
2948 // ClassDeclaration CompilationUnit | 2948 // ClassDeclaration CompilationUnit |
2949 addSource( | 2949 addSource( |
2950 '/testA.dart', | 2950 '/testA.dart', |
2951 ''' | 2951 ''' |
2952 int T1; | 2952 int T1; |
2953 F1() { } | 2953 F1() { } |
2954 typedef D1(); | 2954 typedef D1(); |
2955 class C1 {C1(this.x) { } int x;}'''); | 2955 class C1 {C1(this.x) { } int x;}'''); |
2956 addTestSource(''' | 2956 addTestSource(''' |
2957 import "/testA.dart"; | 2957 import "testA.dart"; |
2958 int T2; | 2958 int T2; |
2959 F2() { } | 2959 F2() { } |
2960 typedef D2(); | 2960 typedef D2(); |
2961 class C2 {/* */ ^ zoo(z) { } String name; }'''); | 2961 class C2 {/* */ ^ zoo(z) { } String name; }'''); |
2962 await computeSuggestions(); | 2962 await computeSuggestions(); |
2963 expect(replacementOffset, completionOffset); | 2963 expect(replacementOffset, completionOffset); |
2964 expect(replacementLength, 0); | 2964 expect(replacementLength, 0); |
2965 assertNotSuggested('Object'); | 2965 assertNotSuggested('Object'); |
2966 assertNotSuggested('T1'); | 2966 assertNotSuggested('T1'); |
2967 assertNotSuggested('F1'); | 2967 assertNotSuggested('F1'); |
2968 assertNotSuggested('D1'); | 2968 assertNotSuggested('D1'); |
2969 assertNotSuggested('C1'); | 2969 assertNotSuggested('C1'); |
2970 assertNotSuggested('T2'); | 2970 assertNotSuggested('T2'); |
2971 assertNotSuggested('F2'); | 2971 assertNotSuggested('F2'); |
2972 assertNotSuggested('D2'); | 2972 assertNotSuggested('D2'); |
2973 assertNotSuggested('C2'); | 2973 assertNotSuggested('C2'); |
2974 assertNotSuggested('name'); | 2974 assertNotSuggested('name'); |
2975 } | 2975 } |
2976 | 2976 |
2977 test_MethodDeclaration_returnType_afterComment2() async { | 2977 test_MethodDeclaration_returnType_afterComment2() async { |
2978 // MethodDeclaration ClassDeclaration CompilationUnit | 2978 // MethodDeclaration ClassDeclaration CompilationUnit |
2979 addSource( | 2979 addSource( |
2980 '/testA.dart', | 2980 '/testA.dart', |
2981 ''' | 2981 ''' |
2982 int T1; | 2982 int T1; |
2983 F1() { } | 2983 F1() { } |
2984 typedef D1(); | 2984 typedef D1(); |
2985 class C1 {C1(this.x) { } int x;}'''); | 2985 class C1 {C1(this.x) { } int x;}'''); |
2986 addTestSource(''' | 2986 addTestSource(''' |
2987 import "/testA.dart"; | 2987 import "testA.dart"; |
2988 int T2; | 2988 int T2; |
2989 F2() { } | 2989 F2() { } |
2990 typedef D2(); | 2990 typedef D2(); |
2991 class C2 {/** */ ^ zoo(z) { } String name; }'''); | 2991 class C2 {/** */ ^ zoo(z) { } String name; }'''); |
2992 await computeSuggestions(); | 2992 await computeSuggestions(); |
2993 expect(replacementOffset, completionOffset); | 2993 expect(replacementOffset, completionOffset); |
2994 expect(replacementLength, 0); | 2994 expect(replacementLength, 0); |
2995 assertNotSuggested('Object'); | 2995 assertNotSuggested('Object'); |
2996 assertNotSuggested('T1'); | 2996 assertNotSuggested('T1'); |
2997 assertNotSuggested('F1'); | 2997 assertNotSuggested('F1'); |
2998 assertNotSuggested('D1'); | 2998 assertNotSuggested('D1'); |
2999 assertNotSuggested('C1'); | 2999 assertNotSuggested('C1'); |
3000 assertNotSuggested('T2'); | 3000 assertNotSuggested('T2'); |
3001 assertNotSuggested('F2'); | 3001 assertNotSuggested('F2'); |
3002 assertNotSuggested('D2'); | 3002 assertNotSuggested('D2'); |
3003 assertNotSuggested('C2'); | 3003 assertNotSuggested('C2'); |
3004 assertNotSuggested('name'); | 3004 assertNotSuggested('name'); |
3005 } | 3005 } |
3006 | 3006 |
3007 test_MethodDeclaration_returnType_afterComment3() async { | 3007 test_MethodDeclaration_returnType_afterComment3() async { |
3008 // MethodDeclaration ClassDeclaration CompilationUnit | 3008 // MethodDeclaration ClassDeclaration CompilationUnit |
3009 addSource( | 3009 addSource( |
3010 '/testA.dart', | 3010 '/testA.dart', |
3011 ''' | 3011 ''' |
3012 int T1; | 3012 int T1; |
3013 F1() { } | 3013 F1() { } |
3014 typedef D1(); | 3014 typedef D1(); |
3015 class C1 {C1(this.x) { } int x;}'''); | 3015 class C1 {C1(this.x) { } int x;}'''); |
3016 addTestSource(''' | 3016 addTestSource(''' |
3017 import "/testA.dart"; | 3017 import "testA.dart"; |
3018 int T2; | 3018 int T2; |
3019 F2() { } | 3019 F2() { } |
3020 typedef D2(); | 3020 typedef D2(); |
3021 class C2 { | 3021 class C2 { |
3022 /// some dartdoc | 3022 /// some dartdoc |
3023 ^ zoo(z) { } String name; }'''); | 3023 ^ zoo(z) { } String name; }'''); |
3024 await computeSuggestions(); | 3024 await computeSuggestions(); |
3025 expect(replacementOffset, completionOffset); | 3025 expect(replacementOffset, completionOffset); |
3026 expect(replacementLength, 0); | 3026 expect(replacementLength, 0); |
3027 assertNotSuggested('Object'); | 3027 assertNotSuggested('Object'); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 '/testB.dart', | 3209 '/testB.dart', |
3210 ''' | 3210 ''' |
3211 lib B; | 3211 lib B; |
3212 int T1; | 3212 int T1; |
3213 F1() { } | 3213 F1() { } |
3214 class X {X.c(); X._d(); z() {}}'''); | 3214 class X {X.c(); X._d(); z() {}}'''); |
3215 addSource( | 3215 addSource( |
3216 '/testA.dart', | 3216 '/testA.dart', |
3217 ''' | 3217 ''' |
3218 library libA; | 3218 library libA; |
3219 import "/testB.dart"; | 3219 import "testB.dart"; |
3220 part "$testFile"; | 3220 part "$testFile"; |
3221 class A { } | 3221 class A { } |
3222 var m;'''); | 3222 var m;'''); |
3223 addTestSource(''' | 3223 addTestSource(''' |
3224 part of libA; | 3224 part of libA; |
3225 class B { factory B.bar(int x) => null; } | 3225 class B { factory B.bar(int x) => null; } |
3226 main() {new ^}'''); | 3226 main() {new ^}'''); |
3227 await computeSuggestions(); | 3227 await computeSuggestions(); |
3228 expect(replacementOffset, completionOffset); | 3228 expect(replacementOffset, completionOffset); |
3229 expect(replacementLength, 0); | 3229 expect(replacementLength, 0); |
(...skipping 18 matching lines...) Expand all Loading... |
3248 int T1; | 3248 int T1; |
3249 F1() { } | 3249 F1() { } |
3250 class X {X.c(); X._d(); z() {}}'''); | 3250 class X {X.c(); X._d(); z() {}}'''); |
3251 addSource( | 3251 addSource( |
3252 '/testA.dart', | 3252 '/testA.dart', |
3253 ''' | 3253 ''' |
3254 part of libA; | 3254 part of libA; |
3255 class B { }'''); | 3255 class B { }'''); |
3256 addTestSource(''' | 3256 addTestSource(''' |
3257 library libA; | 3257 library libA; |
3258 import "/testB.dart"; | 3258 import "testB.dart"; |
3259 part "/testA.dart"; | 3259 part "/testA.dart"; |
3260 class A { A({String boo: 'hoo'}) { } } | 3260 class A { A({String boo: 'hoo'}) { } } |
3261 main() {new ^} | 3261 main() {new ^} |
3262 var m;'''); | 3262 var m;'''); |
3263 await computeSuggestions(); | 3263 await computeSuggestions(); |
3264 expect(replacementOffset, completionOffset); | 3264 expect(replacementOffset, completionOffset); |
3265 expect(replacementLength, 0); | 3265 expect(replacementLength, 0); |
3266 assertNotSuggested('A'); | 3266 assertNotSuggested('A'); |
3267 assertNotSuggested('Object'); | 3267 assertNotSuggested('Object'); |
3268 assertNotSuggested('X.c'); | 3268 assertNotSuggested('X.c'); |
(...skipping 17 matching lines...) Expand all Loading... |
3286 X get f => new A(); | 3286 X get f => new A(); |
3287 get _g => new A();} | 3287 get _g => new A();} |
3288 class B implements I { | 3288 class B implements I { |
3289 static const int scB = 12; | 3289 static const int scB = 12; |
3290 var b; X _c; | 3290 var b; X _c; |
3291 X get d => new A();get _e => new A(); | 3291 X get d => new A();get _e => new A(); |
3292 set s1(I x) {} set _s2(I x) {} | 3292 set s1(I x) {} set _s2(I x) {} |
3293 m(X x) {} I _n(X x) {}} | 3293 m(X x) {} I _n(X x) {}} |
3294 class X{}'''); | 3294 class X{}'''); |
3295 addTestSource(''' | 3295 addTestSource(''' |
3296 import "/testB.dart"; | 3296 import "testB.dart"; |
3297 class A extends B { | 3297 class A extends B { |
3298 static const String scA = 'foo'; | 3298 static const String scA = 'foo'; |
3299 w() { }} | 3299 w() { }} |
3300 main() {A.^}'''); | 3300 main() {A.^}'''); |
3301 await computeSuggestions(); | 3301 await computeSuggestions(); |
3302 expect(replacementOffset, completionOffset); | 3302 expect(replacementOffset, completionOffset); |
3303 expect(replacementLength, 0); | 3303 expect(replacementLength, 0); |
3304 // Suggested by StaticMemberContributor | 3304 // Suggested by StaticMemberContributor |
3305 assertNotSuggested('scA'); | 3305 assertNotSuggested('scA'); |
3306 assertNotSuggested('scB'); | 3306 assertNotSuggested('scB'); |
(...skipping 24 matching lines...) Expand all Loading... |
3331 lib B; | 3331 lib B; |
3332 class I {X get f => new A();get _g => new A();} | 3332 class I {X get f => new A();get _g => new A();} |
3333 class A implements I { | 3333 class A implements I { |
3334 static const int sc = 12; | 3334 static const int sc = 12; |
3335 @deprecated var b; X _c; | 3335 @deprecated var b; X _c; |
3336 X get d => new A();get _e => new A(); | 3336 X get d => new A();get _e => new A(); |
3337 set s1(I x) {} set _s2(I x) {} | 3337 set s1(I x) {} set _s2(I x) {} |
3338 m(X x) {} I _n(X x) {}} | 3338 m(X x) {} I _n(X x) {}} |
3339 class X{}'''); | 3339 class X{}'''); |
3340 addTestSource(''' | 3340 addTestSource(''' |
3341 import "/testB.dart"; | 3341 import "testB.dart"; |
3342 main() {A a; a.^}'''); | 3342 main() {A a; a.^}'''); |
3343 await computeSuggestions(); | 3343 await computeSuggestions(); |
3344 expect(replacementOffset, completionOffset); | 3344 expect(replacementOffset, completionOffset); |
3345 expect(replacementLength, 0); | 3345 expect(replacementLength, 0); |
3346 assertNotSuggested('sc'); | 3346 assertNotSuggested('sc'); |
3347 assertSuggestField('b', null, isDeprecated: true); | 3347 assertSuggestField('b', null, isDeprecated: true); |
3348 assertNotSuggested('_c'); | 3348 assertNotSuggested('_c'); |
3349 assertSuggestGetter('d', 'X'); | 3349 assertSuggestGetter('d', 'X'); |
3350 assertNotSuggested('_e'); | 3350 assertNotSuggested('_e'); |
3351 assertSuggestGetter('f', 'X'); | 3351 assertSuggestGetter('f', 'X'); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3404 test_PrefixedIdentifier_library() async { | 3404 test_PrefixedIdentifier_library() async { |
3405 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3405 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3406 addSource( | 3406 addSource( |
3407 '/testB.dart', | 3407 '/testB.dart', |
3408 ''' | 3408 ''' |
3409 lib B; | 3409 lib B; |
3410 var T1; | 3410 var T1; |
3411 class X { } | 3411 class X { } |
3412 class Y { }'''); | 3412 class Y { }'''); |
3413 addTestSource(''' | 3413 addTestSource(''' |
3414 import "/testB.dart" as b; | 3414 import "testB.dart" as b; |
3415 var T2; | 3415 var T2; |
3416 class A { } | 3416 class A { } |
3417 main() {b.^}'''); | 3417 main() {b.^}'''); |
3418 await computeSuggestions(); | 3418 await computeSuggestions(); |
3419 expect(replacementOffset, completionOffset); | 3419 expect(replacementOffset, completionOffset); |
3420 expect(replacementLength, 0); | 3420 expect(replacementLength, 0); |
3421 // Suggested by LibraryMemberContributor | 3421 // Suggested by LibraryMemberContributor |
3422 assertNotSuggested('X'); | 3422 assertNotSuggested('X'); |
3423 assertNotSuggested('Y'); | 3423 assertNotSuggested('Y'); |
3424 assertNotSuggested('T1'); | 3424 assertNotSuggested('T1'); |
3425 assertNotSuggested('T2'); | 3425 assertNotSuggested('T2'); |
3426 assertNotSuggested('Object'); | 3426 assertNotSuggested('Object'); |
3427 assertNotSuggested('b'); | 3427 assertNotSuggested('b'); |
3428 assertNotSuggested('A'); | 3428 assertNotSuggested('A'); |
3429 assertNotSuggested('=='); | 3429 assertNotSuggested('=='); |
3430 } | 3430 } |
3431 | 3431 |
3432 test_PrefixedIdentifier_library_typesOnly() async { | 3432 test_PrefixedIdentifier_library_typesOnly() async { |
3433 // SimpleIdentifier PrefixedIdentifier TypeName | 3433 // SimpleIdentifier PrefixedIdentifier TypeName |
3434 addSource( | 3434 addSource( |
3435 '/testB.dart', | 3435 '/testB.dart', |
3436 ''' | 3436 ''' |
3437 lib B; | 3437 lib B; |
3438 var T1; | 3438 var T1; |
3439 class X { } | 3439 class X { } |
3440 class Y { }'''); | 3440 class Y { }'''); |
3441 addTestSource(''' | 3441 addTestSource(''' |
3442 import "/testB.dart" as b; | 3442 import "testB.dart" as b; |
3443 var T2; | 3443 var T2; |
3444 class A { } | 3444 class A { } |
3445 foo(b.^ f) {}'''); | 3445 foo(b.^ f) {}'''); |
3446 await computeSuggestions(); | 3446 await computeSuggestions(); |
3447 expect(replacementOffset, completionOffset); | 3447 expect(replacementOffset, completionOffset); |
3448 expect(replacementLength, 0); | 3448 expect(replacementLength, 0); |
3449 // Suggested by LibraryMemberContributor | 3449 // Suggested by LibraryMemberContributor |
3450 assertNotSuggested('X'); | 3450 assertNotSuggested('X'); |
3451 assertNotSuggested('Y'); | 3451 assertNotSuggested('Y'); |
3452 assertNotSuggested('T1'); | 3452 assertNotSuggested('T1'); |
3453 assertNotSuggested('T2'); | 3453 assertNotSuggested('T2'); |
3454 assertNotSuggested('Object'); | 3454 assertNotSuggested('Object'); |
3455 assertNotSuggested('b'); | 3455 assertNotSuggested('b'); |
3456 assertNotSuggested('A'); | 3456 assertNotSuggested('A'); |
3457 assertNotSuggested('=='); | 3457 assertNotSuggested('=='); |
3458 } | 3458 } |
3459 | 3459 |
3460 test_PrefixedIdentifier_library_typesOnly2() async { | 3460 test_PrefixedIdentifier_library_typesOnly2() async { |
3461 // SimpleIdentifier PrefixedIdentifier TypeName | 3461 // SimpleIdentifier PrefixedIdentifier TypeName |
3462 addSource( | 3462 addSource( |
3463 '/testB.dart', | 3463 '/testB.dart', |
3464 ''' | 3464 ''' |
3465 lib B; | 3465 lib B; |
3466 var T1; | 3466 var T1; |
3467 class X { } | 3467 class X { } |
3468 class Y { }'''); | 3468 class Y { }'''); |
3469 addTestSource(''' | 3469 addTestSource(''' |
3470 import "/testB.dart" as b; | 3470 import "testB.dart" as b; |
3471 var T2; | 3471 var T2; |
3472 class A { } | 3472 class A { } |
3473 foo(b.^) {}'''); | 3473 foo(b.^) {}'''); |
3474 await computeSuggestions(); | 3474 await computeSuggestions(); |
3475 expect(replacementOffset, completionOffset); | 3475 expect(replacementOffset, completionOffset); |
3476 expect(replacementLength, 0); | 3476 expect(replacementLength, 0); |
3477 // Suggested by LibraryMemberContributor | 3477 // Suggested by LibraryMemberContributor |
3478 assertNotSuggested('X'); | 3478 assertNotSuggested('X'); |
3479 assertNotSuggested('Y'); | 3479 assertNotSuggested('Y'); |
3480 assertNotSuggested('T1'); | 3480 assertNotSuggested('T1'); |
3481 assertNotSuggested('T2'); | 3481 assertNotSuggested('T2'); |
3482 assertNotSuggested('Object'); | 3482 assertNotSuggested('Object'); |
3483 assertNotSuggested('b'); | 3483 assertNotSuggested('b'); |
3484 assertNotSuggested('A'); | 3484 assertNotSuggested('A'); |
3485 assertNotSuggested('=='); | 3485 assertNotSuggested('=='); |
3486 } | 3486 } |
3487 | 3487 |
3488 test_PrefixedIdentifier_parameter() async { | 3488 test_PrefixedIdentifier_parameter() async { |
3489 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3489 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3490 addSource( | 3490 addSource( |
3491 '/testB.dart', | 3491 '/testB.dart', |
3492 ''' | 3492 ''' |
3493 lib B; | 3493 lib B; |
3494 class _W {M y; var _z;} | 3494 class _W {M y; var _z;} |
3495 class X extends _W {} | 3495 class X extends _W {} |
3496 class M{}'''); | 3496 class M{}'''); |
3497 addTestSource(''' | 3497 addTestSource(''' |
3498 import "/testB.dart"; | 3498 import "testB.dart"; |
3499 foo(X x) {x.^}'''); | 3499 foo(X x) {x.^}'''); |
3500 await computeSuggestions(); | 3500 await computeSuggestions(); |
3501 expect(replacementOffset, completionOffset); | 3501 expect(replacementOffset, completionOffset); |
3502 expect(replacementLength, 0); | 3502 expect(replacementLength, 0); |
3503 assertSuggestField('y', 'M'); | 3503 assertSuggestField('y', 'M'); |
3504 assertNotSuggested('_z'); | 3504 assertNotSuggested('_z'); |
3505 assertNotSuggested('=='); | 3505 assertNotSuggested('=='); |
3506 } | 3506 } |
3507 | 3507 |
3508 test_PrefixedIdentifier_prefix() async { | 3508 test_PrefixedIdentifier_prefix() async { |
3509 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3509 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3510 addSource( | 3510 addSource( |
3511 '/testA.dart', | 3511 '/testA.dart', |
3512 ''' | 3512 ''' |
3513 class A {static int bar = 10;} | 3513 class A {static int bar = 10;} |
3514 _B() {}'''); | 3514 _B() {}'''); |
3515 addTestSource(''' | 3515 addTestSource(''' |
3516 import "/testA.dart"; | 3516 import "testA.dart"; |
3517 class X {foo(){A^.bar}}'''); | 3517 class X {foo(){A^.bar}}'''); |
3518 await computeSuggestions(); | 3518 await computeSuggestions(); |
3519 expect(replacementOffset, completionOffset - 1); | 3519 expect(replacementOffset, completionOffset - 1); |
3520 expect(replacementLength, 1); | 3520 expect(replacementLength, 1); |
3521 assertNotSuggested('A'); | 3521 assertNotSuggested('A'); |
3522 assertNotSuggested('X'); | 3522 assertNotSuggested('X'); |
3523 assertNotSuggested('foo'); | 3523 assertNotSuggested('foo'); |
3524 assertNotSuggested('bar'); | 3524 assertNotSuggested('bar'); |
3525 assertNotSuggested('_B'); | 3525 assertNotSuggested('_B'); |
3526 } | 3526 } |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4078 | 4078 |
4079 test_TypeArgumentList() async { | 4079 test_TypeArgumentList() async { |
4080 // SimpleIdentifier BinaryExpression ExpressionStatement | 4080 // SimpleIdentifier BinaryExpression ExpressionStatement |
4081 addSource( | 4081 addSource( |
4082 '/testA.dart', | 4082 '/testA.dart', |
4083 ''' | 4083 ''' |
4084 class C1 {int x;} | 4084 class C1 {int x;} |
4085 F1() => 0; | 4085 F1() => 0; |
4086 typedef String T1(int blat);'''); | 4086 typedef String T1(int blat);'''); |
4087 addTestSource(''' | 4087 addTestSource(''' |
4088 import "/testA.dart";' | 4088 import "testA.dart";' |
4089 class C2 {int x;} | 4089 class C2 {int x;} |
4090 F2() => 0; | 4090 F2() => 0; |
4091 typedef int T2(int blat); | 4091 typedef int T2(int blat); |
4092 class C<E> {} | 4092 class C<E> {} |
4093 main() { C<^> c; }'''); | 4093 main() { C<^> c; }'''); |
4094 await computeSuggestions(); | 4094 await computeSuggestions(); |
4095 expect(replacementOffset, completionOffset); | 4095 expect(replacementOffset, completionOffset); |
4096 expect(replacementLength, 0); | 4096 expect(replacementLength, 0); |
4097 assertNotSuggested('Object'); | 4097 assertNotSuggested('Object'); |
4098 assertNotSuggested('C1'); | 4098 assertNotSuggested('C1'); |
4099 assertNotSuggested('T1'); | 4099 assertNotSuggested('T1'); |
4100 assertNotSuggested('C2'); | 4100 assertNotSuggested('C2'); |
4101 assertNotSuggested('T2'); | 4101 assertNotSuggested('T2'); |
4102 assertNotSuggested('F1'); | 4102 assertNotSuggested('F1'); |
4103 assertNotSuggested('F2'); | 4103 assertNotSuggested('F2'); |
4104 } | 4104 } |
4105 | 4105 |
4106 test_TypeArgumentList2() async { | 4106 test_TypeArgumentList2() async { |
4107 // TypeName TypeArgumentList TypeName | 4107 // TypeName TypeArgumentList TypeName |
4108 addSource( | 4108 addSource( |
4109 '/testA.dart', | 4109 '/testA.dart', |
4110 ''' | 4110 ''' |
4111 class C1 {int x;} | 4111 class C1 {int x;} |
4112 F1() => 0; | 4112 F1() => 0; |
4113 typedef String T1(int blat);'''); | 4113 typedef String T1(int blat);'''); |
4114 addTestSource(''' | 4114 addTestSource(''' |
4115 import "/testA.dart";' | 4115 import "testA.dart";' |
4116 class C2 {int x;} | 4116 class C2 {int x;} |
4117 F2() => 0; | 4117 F2() => 0; |
4118 typedef int T2(int blat); | 4118 typedef int T2(int blat); |
4119 class C<E> {} | 4119 class C<E> {} |
4120 main() { C<C^> c; }'''); | 4120 main() { C<C^> c; }'''); |
4121 await computeSuggestions(); | 4121 await computeSuggestions(); |
4122 expect(replacementOffset, completionOffset - 1); | 4122 expect(replacementOffset, completionOffset - 1); |
4123 expect(replacementLength, 1); | 4123 expect(replacementLength, 1); |
4124 assertNotSuggested('C1'); | 4124 assertNotSuggested('C1'); |
4125 assertNotSuggested('C2'); | 4125 assertNotSuggested('C2'); |
4126 } | 4126 } |
4127 | 4127 |
4128 test_VariableDeclaration_name() async { | 4128 test_VariableDeclaration_name() async { |
4129 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 4129 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4130 // VariableDeclarationStatement Block | 4130 // VariableDeclarationStatement Block |
4131 addSource( | 4131 addSource( |
4132 '/testB.dart', | 4132 '/testB.dart', |
4133 ''' | 4133 ''' |
4134 lib B; | 4134 lib B; |
4135 foo() { } | 4135 foo() { } |
4136 class _B { } | 4136 class _B { } |
4137 class X {X.c(); X._d(); z() {}}'''); | 4137 class X {X.c(); X._d(); z() {}}'''); |
4138 addTestSource(''' | 4138 addTestSource(''' |
4139 import "/testB.dart"; | 4139 import "testB.dart"; |
4140 class Y {Y.c(); Y._d(); z() {}} | 4140 class Y {Y.c(); Y._d(); z() {}} |
4141 main() {var ^}'''); | 4141 main() {var ^}'''); |
4142 await computeSuggestions(); | 4142 await computeSuggestions(); |
4143 assertNoSuggestions(); | 4143 assertNoSuggestions(); |
4144 } | 4144 } |
4145 | 4145 |
4146 test_VariableDeclarationList_final() async { | 4146 test_VariableDeclarationList_final() async { |
4147 // VariableDeclarationList VariableDeclarationStatement Block | 4147 // VariableDeclarationList VariableDeclarationStatement Block |
4148 addTestSource('main() {final ^} class C { }'); | 4148 addTestSource('main() {final ^} class C { }'); |
4149 await computeSuggestions(); | 4149 await computeSuggestions(); |
4150 assertNotSuggested('Object'); | 4150 assertNotSuggested('Object'); |
4151 assertNotSuggested('C'); | 4151 assertNotSuggested('C'); |
4152 assertNotSuggested('=='); | 4152 assertNotSuggested('=='); |
4153 } | 4153 } |
4154 | 4154 |
4155 test_VariableDeclarationStatement_RHS() async { | 4155 test_VariableDeclarationStatement_RHS() async { |
4156 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 4156 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4157 // VariableDeclarationStatement | 4157 // VariableDeclarationStatement |
4158 addSource( | 4158 addSource( |
4159 '/testB.dart', | 4159 '/testB.dart', |
4160 ''' | 4160 ''' |
4161 lib B; | 4161 lib B; |
4162 foo() { } | 4162 foo() { } |
4163 class _B { } | 4163 class _B { } |
4164 class X {X.c(); X._d(); z() {}}'''); | 4164 class X {X.c(); X._d(); z() {}}'''); |
4165 addTestSource(''' | 4165 addTestSource(''' |
4166 import "/testB.dart"; | 4166 import "testB.dart"; |
4167 class Y {Y.c(); Y._d(); z() {}} | 4167 class Y {Y.c(); Y._d(); z() {}} |
4168 class C {bar(){var f; {var x;} var e = ^}}'''); | 4168 class C {bar(){var f; {var x;} var e = ^}}'''); |
4169 await computeSuggestions(); | 4169 await computeSuggestions(); |
4170 expect(replacementOffset, completionOffset); | 4170 expect(replacementOffset, completionOffset); |
4171 expect(replacementLength, 0); | 4171 expect(replacementLength, 0); |
4172 assertNotSuggested('X'); | 4172 assertNotSuggested('X'); |
4173 assertNotSuggested('_B'); | 4173 assertNotSuggested('_B'); |
4174 assertNotSuggested('Y'); | 4174 assertNotSuggested('Y'); |
4175 assertNotSuggested('C'); | 4175 assertNotSuggested('C'); |
4176 assertNotSuggested('f'); | 4176 assertNotSuggested('f'); |
4177 assertNotSuggested('x'); | 4177 assertNotSuggested('x'); |
4178 assertNotSuggested('e'); | 4178 assertNotSuggested('e'); |
4179 } | 4179 } |
4180 | 4180 |
4181 test_VariableDeclarationStatement_RHS_missing_semicolon() async { | 4181 test_VariableDeclarationStatement_RHS_missing_semicolon() async { |
4182 // VariableDeclaration VariableDeclarationList | 4182 // VariableDeclaration VariableDeclarationList |
4183 // VariableDeclarationStatement | 4183 // VariableDeclarationStatement |
4184 addSource( | 4184 addSource( |
4185 '/testB.dart', | 4185 '/testB.dart', |
4186 ''' | 4186 ''' |
4187 lib B; | 4187 lib B; |
4188 foo1() { } | 4188 foo1() { } |
4189 void bar1() { } | 4189 void bar1() { } |
4190 class _B { } | 4190 class _B { } |
4191 class X {X.c(); X._d(); z() {}}'''); | 4191 class X {X.c(); X._d(); z() {}}'''); |
4192 addTestSource(''' | 4192 addTestSource(''' |
4193 import "/testB.dart"; | 4193 import "testB.dart"; |
4194 foo2() { } | 4194 foo2() { } |
4195 void bar2() { } | 4195 void bar2() { } |
4196 class Y {Y.c(); Y._d(); z() {}} | 4196 class Y {Y.c(); Y._d(); z() {}} |
4197 class C {bar(){var f; {var x;} var e = ^ var g}}'''); | 4197 class C {bar(){var f; {var x;} var e = ^ var g}}'''); |
4198 await computeSuggestions(); | 4198 await computeSuggestions(); |
4199 expect(replacementOffset, completionOffset); | 4199 expect(replacementOffset, completionOffset); |
4200 expect(replacementLength, 0); | 4200 expect(replacementLength, 0); |
4201 assertNotSuggested('X'); | 4201 assertNotSuggested('X'); |
4202 assertNotSuggested('foo1'); | 4202 assertNotSuggested('foo1'); |
4203 assertNotSuggested('bar1'); | 4203 assertNotSuggested('bar1'); |
4204 assertNotSuggested('foo2'); | 4204 assertNotSuggested('foo2'); |
4205 assertNotSuggested('bar2'); | 4205 assertNotSuggested('bar2'); |
4206 assertNotSuggested('_B'); | 4206 assertNotSuggested('_B'); |
4207 assertNotSuggested('Y'); | 4207 assertNotSuggested('Y'); |
4208 assertNotSuggested('C'); | 4208 assertNotSuggested('C'); |
4209 assertNotSuggested('f'); | 4209 assertNotSuggested('f'); |
4210 assertNotSuggested('x'); | 4210 assertNotSuggested('x'); |
4211 assertNotSuggested('e'); | 4211 assertNotSuggested('e'); |
4212 } | 4212 } |
4213 } | 4213 } |
OLD | NEW |