OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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:analyzer_plugin/protocol/protocol_common.dart'; | 7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
8 import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; | 8 import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; |
9 import 'package:analyzer_plugin/utilities/completion/relevance.dart'; | 9 import 'package:analyzer_plugin/utilities/completion/relevance.dart'; |
10 import 'package:analyzer_plugin/utilities/completion/type_member_contributor.dar
t'; | 10 import 'package:analyzer_plugin/utilities/completion/type_member_contributor.dar
t'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 void main() {new A().f^}'''); | 111 void main() {new A().f^}'''); |
112 await computeSuggestions(); | 112 await computeSuggestions(); |
113 | 113 |
114 assertSuggestMethod('foo', 'A', 'bool', | 114 assertSuggestMethod('foo', 'A', 'bool', |
115 defaultArgListString: 'bar, baz: null'); | 115 defaultArgListString: 'bar, baz: null'); |
116 } | 116 } |
117 | 117 |
118 test_ArgumentList() async { | 118 test_ArgumentList() async { |
119 // ArgumentList MethodInvocation ExpressionStatement Block | 119 // ArgumentList MethodInvocation ExpressionStatement Block |
120 addSource( | 120 addSource('/libA.dart', ''' |
121 '/libA.dart', | |
122 ''' | |
123 library A; | 121 library A; |
124 bool hasLength(int expected) { } | 122 bool hasLength(int expected) { } |
125 void baz() { }'''); | 123 void baz() { }'''); |
126 addTestSource(''' | 124 addTestSource(''' |
127 import '/libA.dart'; | 125 import '/libA.dart'; |
128 class B { } | 126 class B { } |
129 String bar() => true; | 127 String bar() => true; |
130 void main() {expect(^)}'''); | 128 void main() {expect(^)}'''); |
131 await computeSuggestions(); | 129 await computeSuggestions(); |
132 expect(replacementOffset, completionOffset); | 130 expect(replacementOffset, completionOffset); |
133 expect(replacementLength, 0); | 131 expect(replacementLength, 0); |
134 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 132 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
135 assertNotSuggested('bar'); | 133 assertNotSuggested('bar'); |
136 assertNotSuggested('hasLength'); | 134 assertNotSuggested('hasLength'); |
137 assertNotSuggested('identical'); | 135 assertNotSuggested('identical'); |
138 assertNotSuggested('B'); | 136 assertNotSuggested('B'); |
139 assertNotSuggested('Object'); | 137 assertNotSuggested('Object'); |
140 assertNotSuggested('main'); | 138 assertNotSuggested('main'); |
141 assertNotSuggested('baz'); | 139 assertNotSuggested('baz'); |
142 assertNotSuggested('print'); | 140 assertNotSuggested('print'); |
143 } | 141 } |
144 | 142 |
145 test_ArgumentList_imported_function() async { | 143 test_ArgumentList_imported_function() async { |
146 // ArgumentList MethodInvocation ExpressionStatement Block | 144 // ArgumentList MethodInvocation ExpressionStatement Block |
147 addSource( | 145 addSource('/libA.dart', ''' |
148 '/libA.dart', | |
149 ''' | |
150 library A; | 146 library A; |
151 bool hasLength(int expected) { } | 147 bool hasLength(int expected) { } |
152 expect(arg) { } | 148 expect(arg) { } |
153 void baz() { }'''); | 149 void baz() { }'''); |
154 addTestSource(''' | 150 addTestSource(''' |
155 import '/libA.dart' | 151 import '/libA.dart' |
156 class B { } | 152 class B { } |
157 String bar() => true; | 153 String bar() => true; |
158 void main() {expect(^)}'''); | 154 void main() {expect(^)}'''); |
159 await computeSuggestions(); | 155 await computeSuggestions(); |
160 expect(replacementOffset, completionOffset); | 156 expect(replacementOffset, completionOffset); |
161 expect(replacementLength, 0); | 157 expect(replacementLength, 0); |
162 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 158 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
163 assertNotSuggested('bar'); | 159 assertNotSuggested('bar'); |
164 assertNotSuggested('hasLength'); | 160 assertNotSuggested('hasLength'); |
165 assertNotSuggested('identical'); | 161 assertNotSuggested('identical'); |
166 assertNotSuggested('B'); | 162 assertNotSuggested('B'); |
167 assertNotSuggested('Object'); | 163 assertNotSuggested('Object'); |
168 assertNotSuggested('main'); | 164 assertNotSuggested('main'); |
169 assertNotSuggested('baz'); | 165 assertNotSuggested('baz'); |
170 assertNotSuggested('print'); | 166 assertNotSuggested('print'); |
171 } | 167 } |
172 | 168 |
173 test_ArgumentList_InstanceCreationExpression_functionalArg() async { | 169 test_ArgumentList_InstanceCreationExpression_functionalArg() async { |
174 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 170 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
175 addSource( | 171 addSource('/libA.dart', ''' |
176 '/libA.dart', | |
177 ''' | |
178 library A; | 172 library A; |
179 class A { A(f()) { } } | 173 class A { A(f()) { } } |
180 bool hasLength(int expected) { } | 174 bool hasLength(int expected) { } |
181 void baz() { }'''); | 175 void baz() { }'''); |
182 addTestSource(''' | 176 addTestSource(''' |
183 import 'dart:async'; | 177 import 'dart:async'; |
184 import '/libA.dart'; | 178 import '/libA.dart'; |
185 class B { } | 179 class B { } |
186 String bar() => true; | 180 String bar() => true; |
187 void main() {new A(^)}'''); | 181 void main() {new A(^)}'''); |
188 await computeSuggestions(); | 182 await computeSuggestions(); |
189 expect(replacementOffset, completionOffset); | 183 expect(replacementOffset, completionOffset); |
190 expect(replacementLength, 0); | 184 expect(replacementLength, 0); |
191 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 185 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
192 assertNotSuggested('bar'); | 186 assertNotSuggested('bar'); |
193 assertNotSuggested('hasLength'); | 187 assertNotSuggested('hasLength'); |
194 assertNotSuggested('identical'); | 188 assertNotSuggested('identical'); |
195 assertNotSuggested('B'); | 189 assertNotSuggested('B'); |
196 assertNotSuggested('A'); | 190 assertNotSuggested('A'); |
197 assertNotSuggested('Object'); | 191 assertNotSuggested('Object'); |
198 assertNotSuggested('main'); | 192 assertNotSuggested('main'); |
199 assertNotSuggested('baz'); | 193 assertNotSuggested('baz'); |
200 assertNotSuggested('print'); | 194 assertNotSuggested('print'); |
201 } | 195 } |
202 | 196 |
203 test_ArgumentList_InstanceCreationExpression_typedefArg() async { | 197 test_ArgumentList_InstanceCreationExpression_typedefArg() async { |
204 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 198 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
205 addSource( | 199 addSource('/libA.dart', ''' |
206 '/libA.dart', | |
207 ''' | |
208 library A; | 200 library A; |
209 typedef Funct(); | 201 typedef Funct(); |
210 class A { A(Funct f) { } } | 202 class A { A(Funct f) { } } |
211 bool hasLength(int expected) { } | 203 bool hasLength(int expected) { } |
212 void baz() { }'''); | 204 void baz() { }'''); |
213 addTestSource(''' | 205 addTestSource(''' |
214 import 'dart:async'; | 206 import 'dart:async'; |
215 import '/libA.dart'; | 207 import '/libA.dart'; |
216 class B { } | 208 class B { } |
217 String bar() => true; | 209 String bar() => true; |
218 void main() {new A(^)}'''); | 210 void main() {new A(^)}'''); |
219 await computeSuggestions(); | 211 await computeSuggestions(); |
220 expect(replacementOffset, completionOffset); | 212 expect(replacementOffset, completionOffset); |
221 expect(replacementLength, 0); | 213 expect(replacementLength, 0); |
222 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 214 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
223 assertNotSuggested('bar'); | 215 assertNotSuggested('bar'); |
224 assertNotSuggested('hasLength'); | 216 assertNotSuggested('hasLength'); |
225 assertNotSuggested('identical'); | 217 assertNotSuggested('identical'); |
226 assertNotSuggested('B'); | 218 assertNotSuggested('B'); |
227 assertNotSuggested('A'); | 219 assertNotSuggested('A'); |
228 assertNotSuggested('Object'); | 220 assertNotSuggested('Object'); |
229 assertNotSuggested('main'); | 221 assertNotSuggested('main'); |
230 assertNotSuggested('baz'); | 222 assertNotSuggested('baz'); |
231 assertNotSuggested('print'); | 223 assertNotSuggested('print'); |
232 } | 224 } |
233 | 225 |
234 test_ArgumentList_local_function() async { | 226 test_ArgumentList_local_function() async { |
235 // ArgumentList MethodInvocation ExpressionStatement Block | 227 // ArgumentList MethodInvocation ExpressionStatement Block |
236 addSource( | 228 addSource('/libA.dart', ''' |
237 '/libA.dart', | |
238 ''' | |
239 library A; | 229 library A; |
240 bool hasLength(int expected) { } | 230 bool hasLength(int expected) { } |
241 void baz() { }'''); | 231 void baz() { }'''); |
242 addTestSource(''' | 232 addTestSource(''' |
243 import '/libA.dart' | 233 import '/libA.dart' |
244 expect(arg) { } | 234 expect(arg) { } |
245 class B { } | 235 class B { } |
246 String bar() => true; | 236 String bar() => true; |
247 void main() {expect(^)}'''); | 237 void main() {expect(^)}'''); |
248 await computeSuggestions(); | 238 await computeSuggestions(); |
249 expect(replacementOffset, completionOffset); | 239 expect(replacementOffset, completionOffset); |
250 expect(replacementLength, 0); | 240 expect(replacementLength, 0); |
251 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 241 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
252 assertNotSuggested('bar'); | 242 assertNotSuggested('bar'); |
253 assertNotSuggested('hasLength'); | 243 assertNotSuggested('hasLength'); |
254 assertNotSuggested('identical'); | 244 assertNotSuggested('identical'); |
255 assertNotSuggested('B'); | 245 assertNotSuggested('B'); |
256 assertNotSuggested('Object'); | 246 assertNotSuggested('Object'); |
257 assertNotSuggested('main'); | 247 assertNotSuggested('main'); |
258 assertNotSuggested('baz'); | 248 assertNotSuggested('baz'); |
259 assertNotSuggested('print'); | 249 assertNotSuggested('print'); |
260 } | 250 } |
261 | 251 |
262 test_ArgumentList_local_method() async { | 252 test_ArgumentList_local_method() async { |
263 // ArgumentList MethodInvocation ExpressionStatement Block | 253 // ArgumentList MethodInvocation ExpressionStatement Block |
264 addSource( | 254 addSource('/libA.dart', ''' |
265 '/libA.dart', | |
266 ''' | |
267 library A; | 255 library A; |
268 bool hasLength(int expected) { } | 256 bool hasLength(int expected) { } |
269 void baz() { }'''); | 257 void baz() { }'''); |
270 addTestSource(''' | 258 addTestSource(''' |
271 import '/libA.dart' | 259 import '/libA.dart' |
272 class B { | 260 class B { |
273 expect(arg) { } | 261 expect(arg) { } |
274 void foo() {expect(^)}} | 262 void foo() {expect(^)}} |
275 String bar() => true;'''); | 263 String bar() => true;'''); |
276 await computeSuggestions(); | 264 await computeSuggestions(); |
277 expect(replacementOffset, completionOffset); | 265 expect(replacementOffset, completionOffset); |
278 expect(replacementLength, 0); | 266 expect(replacementLength, 0); |
279 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 267 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
280 assertNotSuggested('bar'); | 268 assertNotSuggested('bar'); |
281 assertNotSuggested('hasLength'); | 269 assertNotSuggested('hasLength'); |
282 assertNotSuggested('identical'); | 270 assertNotSuggested('identical'); |
283 assertNotSuggested('B'); | 271 assertNotSuggested('B'); |
284 assertNotSuggested('Object'); | 272 assertNotSuggested('Object'); |
285 assertNotSuggested('main'); | 273 assertNotSuggested('main'); |
286 assertNotSuggested('baz'); | 274 assertNotSuggested('baz'); |
287 assertNotSuggested('print'); | 275 assertNotSuggested('print'); |
288 } | 276 } |
289 | 277 |
290 test_ArgumentList_MethodInvocation_functionalArg() async { | 278 test_ArgumentList_MethodInvocation_functionalArg() async { |
291 // ArgumentList MethodInvocation ExpressionStatement Block | 279 // ArgumentList MethodInvocation ExpressionStatement Block |
292 addSource( | 280 addSource('/libA.dart', ''' |
293 '/libA.dart', | |
294 ''' | |
295 library A; | 281 library A; |
296 class A { A(f()) { } } | 282 class A { A(f()) { } } |
297 bool hasLength(int expected) { } | 283 bool hasLength(int expected) { } |
298 void baz() { }'''); | 284 void baz() { }'''); |
299 addTestSource(''' | 285 addTestSource(''' |
300 import 'dart:async'; | 286 import 'dart:async'; |
301 import '/libA.dart'; | 287 import '/libA.dart'; |
302 class B { } | 288 class B { } |
303 String bar(f()) => true; | 289 String bar(f()) => true; |
304 void main() {bar(^);}'''); | 290 void main() {bar(^);}'''); |
305 await computeSuggestions(); | 291 await computeSuggestions(); |
306 expect(replacementOffset, completionOffset); | 292 expect(replacementOffset, completionOffset); |
307 expect(replacementLength, 0); | 293 expect(replacementLength, 0); |
308 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 294 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
309 assertNotSuggested('bar'); | 295 assertNotSuggested('bar'); |
310 assertNotSuggested('hasLength'); | 296 assertNotSuggested('hasLength'); |
311 assertNotSuggested('identical'); | 297 assertNotSuggested('identical'); |
312 assertNotSuggested('B'); | 298 assertNotSuggested('B'); |
313 assertNotSuggested('A'); | 299 assertNotSuggested('A'); |
314 assertNotSuggested('Object'); | 300 assertNotSuggested('Object'); |
315 assertNotSuggested('main'); | 301 assertNotSuggested('main'); |
316 assertNotSuggested('baz'); | 302 assertNotSuggested('baz'); |
317 assertNotSuggested('print'); | 303 assertNotSuggested('print'); |
318 } | 304 } |
319 | 305 |
320 test_ArgumentList_MethodInvocation_methodArg() async { | 306 test_ArgumentList_MethodInvocation_methodArg() async { |
321 // ArgumentList MethodInvocation ExpressionStatement Block | 307 // ArgumentList MethodInvocation ExpressionStatement Block |
322 addSource( | 308 addSource('/libA.dart', ''' |
323 '/libA.dart', | |
324 ''' | |
325 library A; | 309 library A; |
326 class A { A(f()) { } } | 310 class A { A(f()) { } } |
327 bool hasLength(int expected) { } | 311 bool hasLength(int expected) { } |
328 void baz() { }'''); | 312 void baz() { }'''); |
329 addTestSource(''' | 313 addTestSource(''' |
330 import 'dart:async'; | 314 import 'dart:async'; |
331 import '/libA.dart'; | 315 import '/libA.dart'; |
332 class B { String bar(f()) => true; } | 316 class B { String bar(f()) => true; } |
333 void main() {new B().bar(^);}'''); | 317 void main() {new B().bar(^);}'''); |
334 await computeSuggestions(); | 318 await computeSuggestions(); |
335 expect(replacementOffset, completionOffset); | 319 expect(replacementOffset, completionOffset); |
336 expect(replacementLength, 0); | 320 expect(replacementLength, 0); |
337 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 321 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
338 assertNotSuggested('hasLength'); | 322 assertNotSuggested('hasLength'); |
339 assertNotSuggested('identical'); | 323 assertNotSuggested('identical'); |
340 assertNotSuggested('B'); | 324 assertNotSuggested('B'); |
341 assertNotSuggested('A'); | 325 assertNotSuggested('A'); |
342 assertNotSuggested('Object'); | 326 assertNotSuggested('Object'); |
343 assertNotSuggested('main'); | 327 assertNotSuggested('main'); |
344 assertNotSuggested('baz'); | 328 assertNotSuggested('baz'); |
345 assertNotSuggested('print'); | 329 assertNotSuggested('print'); |
346 } | 330 } |
347 | 331 |
348 test_ArgumentList_namedParam() async { | 332 test_ArgumentList_namedParam() async { |
349 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation | 333 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation |
350 // ExpressionStatement | 334 // ExpressionStatement |
351 addSource( | 335 addSource('/libA.dart', ''' |
352 '/libA.dart', | |
353 ''' | |
354 library A; | 336 library A; |
355 bool hasLength(int expected) { }'''); | 337 bool hasLength(int expected) { }'''); |
356 addTestSource(''' | 338 addTestSource(''' |
357 import '/libA.dart' | 339 import '/libA.dart' |
358 String bar() => true; | 340 String bar() => true; |
359 void main() {expect(foo: ^)}'''); | 341 void main() {expect(foo: ^)}'''); |
360 await computeSuggestions(); | 342 await computeSuggestions(); |
361 expect(replacementOffset, completionOffset); | 343 expect(replacementOffset, completionOffset); |
362 expect(replacementLength, 0); | 344 expect(replacementLength, 0); |
363 assertNotSuggested('bar'); | 345 assertNotSuggested('bar'); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 expect(replacementOffset, completionOffset); | 502 expect(replacementOffset, completionOffset); |
521 expect(replacementLength, 0); | 503 expect(replacementLength, 0); |
522 assertNotSuggested('a'); | 504 assertNotSuggested('a'); |
523 assertNotSuggested('Object'); | 505 assertNotSuggested('Object'); |
524 assertNotSuggested('b'); | 506 assertNotSuggested('b'); |
525 assertNotSuggested('=='); | 507 assertNotSuggested('=='); |
526 } | 508 } |
527 | 509 |
528 test_Block() async { | 510 test_Block() async { |
529 // Block BlockFunctionBody MethodDeclaration | 511 // Block BlockFunctionBody MethodDeclaration |
530 addSource( | 512 addSource('/testAB.dart', ''' |
531 '/testAB.dart', | |
532 ''' | |
533 export "dart:math" hide max; | 513 export "dart:math" hide max; |
534 class A {int x;} | 514 class A {int x;} |
535 @deprecated D1() {int x;} | 515 @deprecated D1() {int x;} |
536 class _B {boo() { partBoo() {}} }'''); | 516 class _B {boo() { partBoo() {}} }'''); |
537 addSource( | 517 addSource('/testCD.dart', ''' |
538 '/testCD.dart', | |
539 ''' | |
540 String T1; | 518 String T1; |
541 var _T2; | 519 var _T2; |
542 class C { } | 520 class C { } |
543 class D { }'''); | 521 class D { }'''); |
544 addSource( | 522 addSource('/testEEF.dart', ''' |
545 '/testEEF.dart', | |
546 ''' | |
547 class EE { } | 523 class EE { } |
548 class F { }'''); | 524 class F { }'''); |
549 addSource('/testG.dart', 'class G { }'); | 525 addSource('/testG.dart', 'class G { }'); |
550 addSource( | 526 addSource('/testH.dart', ''' |
551 '/testH.dart', | |
552 ''' | |
553 class H { } | 527 class H { } |
554 int T3; | 528 int T3; |
555 var _T4;'''); // not imported | 529 var _T4;'''); // not imported |
556 addTestSource(''' | 530 addTestSource(''' |
557 import "testAB.dart"; | 531 import "testAB.dart"; |
558 import "testCD.dart" hide D; | 532 import "testCD.dart" hide D; |
559 import "testEEF.dart" show EE; | 533 import "testEEF.dart" show EE; |
560 import "testG.dart" as g; | 534 import "testG.dart" as g; |
561 int T5; | 535 int T5; |
562 var _T6; | 536 var _T6; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 assertNotSuggested('blog'); | 594 assertNotSuggested('blog'); |
621 // TODO (danrubel) suggest HtmlElement as low relevance | 595 // TODO (danrubel) suggest HtmlElement as low relevance |
622 assertNotSuggested('HtmlElement'); | 596 assertNotSuggested('HtmlElement'); |
623 assertNotSuggested('Uri'); | 597 assertNotSuggested('Uri'); |
624 assertNotSuggested('parseIPv6Address'); | 598 assertNotSuggested('parseIPv6Address'); |
625 assertNotSuggested('parseHex'); | 599 assertNotSuggested('parseHex'); |
626 } | 600 } |
627 | 601 |
628 test_Block_final() async { | 602 test_Block_final() async { |
629 // Block BlockFunctionBody MethodDeclaration | 603 // Block BlockFunctionBody MethodDeclaration |
630 addSource( | 604 addSource('/testAB.dart', ''' |
631 '/testAB.dart', | |
632 ''' | |
633 export "dart:math" hide max; | 605 export "dart:math" hide max; |
634 class A {int x;} | 606 class A {int x;} |
635 @deprecated D1() {int x;} | 607 @deprecated D1() {int x;} |
636 class _B {boo() { partBoo() {}} }'''); | 608 class _B {boo() { partBoo() {}} }'''); |
637 addSource( | 609 addSource('/testCD.dart', ''' |
638 '/testCD.dart', | |
639 ''' | |
640 String T1; | 610 String T1; |
641 var _T2; | 611 var _T2; |
642 class C { } | 612 class C { } |
643 class D { }'''); | 613 class D { }'''); |
644 addSource( | 614 addSource('/testEEF.dart', ''' |
645 '/testEEF.dart', | |
646 ''' | |
647 class EE { } | 615 class EE { } |
648 class F { }'''); | 616 class F { }'''); |
649 addSource('/testG.dart', 'class G { }'); | 617 addSource('/testG.dart', 'class G { }'); |
650 addSource( | 618 addSource('/testH.dart', ''' |
651 '/testH.dart', | |
652 ''' | |
653 class H { } | 619 class H { } |
654 int T3; | 620 int T3; |
655 var _T4;'''); // not imported | 621 var _T4;'''); // not imported |
656 addTestSource(''' | 622 addTestSource(''' |
657 import "testAB.dart"; | 623 import "testAB.dart"; |
658 import "testCD.dart" hide D; | 624 import "testCD.dart" hide D; |
659 import "testEEF.dart" show EE; | 625 import "testEEF.dart" show EE; |
660 import "testG.dart" as g; | 626 import "testG.dart" as g; |
661 int T5; | 627 int T5; |
662 var _T6; | 628 var _T6; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 706 |
741 test_Block_final3() async { | 707 test_Block_final3() async { |
742 addTestSource('main() {final ^ v;}'); | 708 addTestSource('main() {final ^ v;}'); |
743 await computeSuggestions(); | 709 await computeSuggestions(); |
744 | 710 |
745 assertNotSuggested('String'); | 711 assertNotSuggested('String'); |
746 } | 712 } |
747 | 713 |
748 test_Block_final_final() async { | 714 test_Block_final_final() async { |
749 // Block BlockFunctionBody MethodDeclaration | 715 // Block BlockFunctionBody MethodDeclaration |
750 addSource( | 716 addSource('/testAB.dart', ''' |
751 '/testAB.dart', | |
752 ''' | |
753 export "dart:math" hide max; | 717 export "dart:math" hide max; |
754 class A {int x;} | 718 class A {int x;} |
755 @deprecated D1() {int x;} | 719 @deprecated D1() {int x;} |
756 class _B {boo() { partBoo() {}} }'''); | 720 class _B {boo() { partBoo() {}} }'''); |
757 addSource( | 721 addSource('/testCD.dart', ''' |
758 '/testCD.dart', | |
759 ''' | |
760 String T1; | 722 String T1; |
761 var _T2; | 723 var _T2; |
762 class C { } | 724 class C { } |
763 class D { }'''); | 725 class D { }'''); |
764 addSource( | 726 addSource('/testEEF.dart', ''' |
765 '/testEEF.dart', | |
766 ''' | |
767 class EE { } | 727 class EE { } |
768 class F { }'''); | 728 class F { }'''); |
769 addSource('/testG.dart', 'class G { }'); | 729 addSource('/testG.dart', 'class G { }'); |
770 addSource( | 730 addSource('/testH.dart', ''' |
771 '/testH.dart', | |
772 ''' | |
773 class H { } | 731 class H { } |
774 int T3; | 732 int T3; |
775 var _T4;'''); // not imported | 733 var _T4;'''); // not imported |
776 addTestSource(''' | 734 addTestSource(''' |
777 import "testAB.dart"; | 735 import "testAB.dart"; |
778 import "testCD.dart" hide D; | 736 import "testCD.dart" hide D; |
779 import "testEEF.dart" show EE; | 737 import "testEEF.dart" show EE; |
780 import "testG.dart" as g; | 738 import "testG.dart" as g; |
781 int T5; | 739 int T5; |
782 var _T6; | 740 var _T6; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 assertNotSuggested('blog'); | 804 assertNotSuggested('blog'); |
847 // TODO (danrubel) suggest HtmlElement as low relevance | 805 // TODO (danrubel) suggest HtmlElement as low relevance |
848 assertNotSuggested('HtmlElement'); | 806 assertNotSuggested('HtmlElement'); |
849 assertNotSuggested('Uri'); | 807 assertNotSuggested('Uri'); |
850 assertNotSuggested('parseIPv6Address'); | 808 assertNotSuggested('parseIPv6Address'); |
851 assertNotSuggested('parseHex'); | 809 assertNotSuggested('parseHex'); |
852 } | 810 } |
853 | 811 |
854 test_Block_final_var() async { | 812 test_Block_final_var() async { |
855 // Block BlockFunctionBody MethodDeclaration | 813 // Block BlockFunctionBody MethodDeclaration |
856 addSource( | 814 addSource('/testAB.dart', ''' |
857 '/testAB.dart', | |
858 ''' | |
859 export "dart:math" hide max; | 815 export "dart:math" hide max; |
860 class A {int x;} | 816 class A {int x;} |
861 @deprecated D1() {int x;} | 817 @deprecated D1() {int x;} |
862 class _B {boo() { partBoo() {}} }'''); | 818 class _B {boo() { partBoo() {}} }'''); |
863 addSource( | 819 addSource('/testCD.dart', ''' |
864 '/testCD.dart', | |
865 ''' | |
866 String T1; | 820 String T1; |
867 var _T2; | 821 var _T2; |
868 class C { } | 822 class C { } |
869 class D { }'''); | 823 class D { }'''); |
870 addSource( | 824 addSource('/testEEF.dart', ''' |
871 '/testEEF.dart', | |
872 ''' | |
873 class EE { } | 825 class EE { } |
874 class F { }'''); | 826 class F { }'''); |
875 addSource('/testG.dart', 'class G { }'); | 827 addSource('/testG.dart', 'class G { }'); |
876 addSource( | 828 addSource('/testH.dart', ''' |
877 '/testH.dart', | |
878 ''' | |
879 class H { } | 829 class H { } |
880 int T3; | 830 int T3; |
881 var _T4;'''); // not imported | 831 var _T4;'''); // not imported |
882 addTestSource(''' | 832 addTestSource(''' |
883 import "testAB.dart"; | 833 import "testAB.dart"; |
884 import "testCD.dart" hide D; | 834 import "testCD.dart" hide D; |
885 import "testEEF.dart" show EE; | 835 import "testEEF.dart" show EE; |
886 import "testG.dart" as g; | 836 import "testG.dart" as g; |
887 int T5; | 837 int T5; |
888 var _T6; | 838 var _T6; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 assertNotSuggested('clog'); | 901 assertNotSuggested('clog'); |
952 assertNotSuggested('blog'); | 902 assertNotSuggested('blog'); |
953 // TODO (danrubel) suggest HtmlElement as low relevance | 903 // TODO (danrubel) suggest HtmlElement as low relevance |
954 assertNotSuggested('HtmlElement'); | 904 assertNotSuggested('HtmlElement'); |
955 assertNotSuggested('Uri'); | 905 assertNotSuggested('Uri'); |
956 assertNotSuggested('parseIPv6Address'); | 906 assertNotSuggested('parseIPv6Address'); |
957 assertNotSuggested('parseHex'); | 907 assertNotSuggested('parseHex'); |
958 } | 908 } |
959 | 909 |
960 test_Block_identifier_partial() async { | 910 test_Block_identifier_partial() async { |
961 addSource( | 911 addSource('/testAB.dart', ''' |
962 '/testAB.dart', | |
963 ''' | |
964 export "dart:math" hide max; | 912 export "dart:math" hide max; |
965 class A {int x;} | 913 class A {int x;} |
966 @deprecated D1() {int x;} | 914 @deprecated D1() {int x;} |
967 class _B { }'''); | 915 class _B { }'''); |
968 addSource( | 916 addSource('/testCD.dart', ''' |
969 '/testCD.dart', | |
970 ''' | |
971 String T1; | 917 String T1; |
972 var _T2; | 918 var _T2; |
973 class C { } | 919 class C { } |
974 class D { }'''); | 920 class D { }'''); |
975 addSource( | 921 addSource('/testEEF.dart', ''' |
976 '/testEEF.dart', | |
977 ''' | |
978 class EE { } | 922 class EE { } |
979 class F { }'''); | 923 class F { }'''); |
980 addSource('/testG.dart', 'class G { }'); | 924 addSource('/testG.dart', 'class G { }'); |
981 addSource( | 925 addSource('/testH.dart', ''' |
982 '/testH.dart', | |
983 ''' | |
984 class H { } | 926 class H { } |
985 class D3 { } | 927 class D3 { } |
986 int T3; | 928 int T3; |
987 var _T4;'''); // not imported | 929 var _T4;'''); // not imported |
988 addTestSource(''' | 930 addTestSource(''' |
989 import "testAB.dart"; | 931 import "testAB.dart"; |
990 import "testCD.dart" hide D; | 932 import "testCD.dart" hide D; |
991 import "testEEF.dart" show EE; | 933 import "testEEF.dart" show EE; |
992 import "testG.dart" as g; | 934 import "testG.dart" as g; |
993 int T5; | 935 int T5; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 assertNotSuggested('_T4'); | 980 assertNotSuggested('_T4'); |
1039 //assertNotSuggested('T5'); | 981 //assertNotSuggested('T5'); |
1040 //assertNotSuggested('_T6'); | 982 //assertNotSuggested('_T6'); |
1041 assertNotSuggested('=='); | 983 assertNotSuggested('=='); |
1042 // TODO (danrubel) suggest HtmlElement as low relevance | 984 // TODO (danrubel) suggest HtmlElement as low relevance |
1043 assertNotSuggested('HtmlElement'); | 985 assertNotSuggested('HtmlElement'); |
1044 } | 986 } |
1045 | 987 |
1046 test_Block_inherited_imported() async { | 988 test_Block_inherited_imported() async { |
1047 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | 989 // Block BlockFunctionBody MethodDeclaration ClassDeclaration |
1048 addSource( | 990 addSource('/testB.dart', ''' |
1049 '/testB.dart', | |
1050 ''' | |
1051 lib B; | 991 lib B; |
1052 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } | 992 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } |
1053 class E extends F { var e1; e2() { } } | 993 class E extends F { var e1; e2() { } } |
1054 class I { int i1; i2() { } } | 994 class I { int i1; i2() { } } |
1055 class M { var m1; int m2() { } }'''); | 995 class M { var m1; int m2() { } }'''); |
1056 addTestSource(''' | 996 addTestSource(''' |
1057 import "testB.dart"; | 997 import "testB.dart"; |
1058 class A extends E implements I with M {a() {^}}'''); | 998 class A extends E implements I with M {a() {^}}'''); |
1059 await computeSuggestions(); | 999 await computeSuggestions(); |
1060 | 1000 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 assertNotSuggested('m1'); | 1033 assertNotSuggested('m1'); |
1094 assertNotSuggested('f3'); | 1034 assertNotSuggested('f3'); |
1095 assertNotSuggested('f4'); | 1035 assertNotSuggested('f4'); |
1096 assertNotSuggested('e2'); | 1036 assertNotSuggested('e2'); |
1097 assertNotSuggested('f2'); | 1037 assertNotSuggested('f2'); |
1098 assertNotSuggested('i2'); | 1038 assertNotSuggested('i2'); |
1099 assertNotSuggested('m2'); | 1039 assertNotSuggested('m2'); |
1100 } | 1040 } |
1101 | 1041 |
1102 test_Block_local_function() async { | 1042 test_Block_local_function() async { |
1103 addSource( | 1043 addSource('/testAB.dart', ''' |
1104 '/testAB.dart', | |
1105 ''' | |
1106 export "dart:math" hide max; | 1044 export "dart:math" hide max; |
1107 class A {int x;} | 1045 class A {int x;} |
1108 @deprecated D1() {int x;} | 1046 @deprecated D1() {int x;} |
1109 class _B {boo() { partBoo() {}} }'''); | 1047 class _B {boo() { partBoo() {}} }'''); |
1110 addSource( | 1048 addSource('/testCD.dart', ''' |
1111 '/testCD.dart', | |
1112 ''' | |
1113 String T1; | 1049 String T1; |
1114 var _T2; | 1050 var _T2; |
1115 class C { } | 1051 class C { } |
1116 class D { }'''); | 1052 class D { }'''); |
1117 addSource( | 1053 addSource('/testEEF.dart', ''' |
1118 '/testEEF.dart', | |
1119 ''' | |
1120 class EE { } | 1054 class EE { } |
1121 class F { }'''); | 1055 class F { }'''); |
1122 addSource('/testG.dart', 'class G { }'); | 1056 addSource('/testG.dart', 'class G { }'); |
1123 addSource( | 1057 addSource('/testH.dart', ''' |
1124 '/testH.dart', | |
1125 ''' | |
1126 class H { } | 1058 class H { } |
1127 int T3; | 1059 int T3; |
1128 var _T4;'''); // not imported | 1060 var _T4;'''); // not imported |
1129 addTestSource(''' | 1061 addTestSource(''' |
1130 import "testAB.dart"; | 1062 import "testAB.dart"; |
1131 import "testCD.dart" hide D; | 1063 import "testCD.dart" hide D; |
1132 import "testEEF.dart" show EE; | 1064 import "testEEF.dart" show EE; |
1133 import "testG.dart" as g; | 1065 import "testG.dart" as g; |
1134 int T5; | 1066 int T5; |
1135 var _T6; | 1067 var _T6; |
(...skipping 30 matching lines...) Expand all Loading... |
1166 expect(replacementOffset, completionOffset - 1); | 1098 expect(replacementOffset, completionOffset - 1); |
1167 expect(replacementLength, 1); | 1099 expect(replacementLength, 1); |
1168 assertNotSuggested('Foo'); | 1100 assertNotSuggested('Foo'); |
1169 // TODO(danrubel) implement | 1101 // TODO(danrubel) implement |
1170 assertNotSuggested('Foo2'); | 1102 assertNotSuggested('Foo2'); |
1171 assertNotSuggested('Future'); | 1103 assertNotSuggested('Future'); |
1172 } | 1104 } |
1173 | 1105 |
1174 test_CascadeExpression_method1() async { | 1106 test_CascadeExpression_method1() async { |
1175 // PropertyAccess CascadeExpression ExpressionStatement Block | 1107 // PropertyAccess CascadeExpression ExpressionStatement Block |
1176 addSource( | 1108 addSource('/testB.dart', ''' |
1177 '/testB.dart', | |
1178 ''' | |
1179 class B { }'''); | 1109 class B { }'''); |
1180 addTestSource(''' | 1110 addTestSource(''' |
1181 import "testB.dart"; | 1111 import "testB.dart"; |
1182 class A {var b; X _c;} | 1112 class A {var b; X _c;} |
1183 class X{} | 1113 class X{} |
1184 // looks like a cascade to the parser | 1114 // looks like a cascade to the parser |
1185 // but the user is trying to get completions for a non-cascade | 1115 // but the user is trying to get completions for a non-cascade |
1186 main() {A a; a.^.z()}'''); | 1116 main() {A a; a.^.z()}'''); |
1187 await computeSuggestions(); | 1117 await computeSuggestions(); |
1188 expect(replacementOffset, completionOffset); | 1118 expect(replacementOffset, completionOffset); |
1189 expect(replacementLength, 0); | 1119 expect(replacementLength, 0); |
1190 assertSuggestField('b', null); | 1120 assertSuggestField('b', null); |
1191 assertSuggestField('_c', 'X'); | 1121 assertSuggestField('_c', 'X'); |
1192 assertNotSuggested('Object'); | 1122 assertNotSuggested('Object'); |
1193 assertNotSuggested('A'); | 1123 assertNotSuggested('A'); |
1194 assertNotSuggested('B'); | 1124 assertNotSuggested('B'); |
1195 assertNotSuggested('X'); | 1125 assertNotSuggested('X'); |
1196 assertNotSuggested('z'); | 1126 assertNotSuggested('z'); |
1197 assertNotSuggested('=='); | 1127 assertNotSuggested('=='); |
1198 } | 1128 } |
1199 | 1129 |
1200 test_CascadeExpression_selector1() async { | 1130 test_CascadeExpression_selector1() async { |
1201 // PropertyAccess CascadeExpression ExpressionStatement Block | 1131 // PropertyAccess CascadeExpression ExpressionStatement Block |
1202 addSource( | 1132 addSource('/testB.dart', ''' |
1203 '/testB.dart', | |
1204 ''' | |
1205 class B { }'''); | 1133 class B { }'''); |
1206 addTestSource(''' | 1134 addTestSource(''' |
1207 import "testB.dart"; | 1135 import "testB.dart"; |
1208 class A {var b; X _c;} | 1136 class A {var b; X _c;} |
1209 class X{} | 1137 class X{} |
1210 // looks like a cascade to the parser | 1138 // looks like a cascade to the parser |
1211 // but the user is trying to get completions for a non-cascade | 1139 // but the user is trying to get completions for a non-cascade |
1212 main() {A a; a.^.z}'''); | 1140 main() {A a; a.^.z}'''); |
1213 await computeSuggestions(); | 1141 await computeSuggestions(); |
1214 expect(replacementOffset, completionOffset); | 1142 expect(replacementOffset, completionOffset); |
1215 expect(replacementLength, 0); | 1143 expect(replacementLength, 0); |
1216 assertSuggestField('b', null); | 1144 assertSuggestField('b', null); |
1217 assertSuggestField('_c', 'X'); | 1145 assertSuggestField('_c', 'X'); |
1218 assertNotSuggested('Object'); | 1146 assertNotSuggested('Object'); |
1219 assertNotSuggested('A'); | 1147 assertNotSuggested('A'); |
1220 assertNotSuggested('B'); | 1148 assertNotSuggested('B'); |
1221 assertNotSuggested('X'); | 1149 assertNotSuggested('X'); |
1222 assertNotSuggested('z'); | 1150 assertNotSuggested('z'); |
1223 assertNotSuggested('=='); | 1151 assertNotSuggested('=='); |
1224 } | 1152 } |
1225 | 1153 |
1226 test_CascadeExpression_selector2() async { | 1154 test_CascadeExpression_selector2() async { |
1227 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement | 1155 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement |
1228 addSource( | 1156 addSource('/testB.dart', ''' |
1229 '/testB.dart', | |
1230 ''' | |
1231 class B { }'''); | 1157 class B { }'''); |
1232 addTestSource(''' | 1158 addTestSource(''' |
1233 import "testB.dart"; | 1159 import "testB.dart"; |
1234 class A {var b; X _c;} | 1160 class A {var b; X _c;} |
1235 class X{} | 1161 class X{} |
1236 main() {A a; a..^z}'''); | 1162 main() {A a; a..^z}'''); |
1237 await computeSuggestions(); | 1163 await computeSuggestions(); |
1238 expect(replacementOffset, completionOffset); | 1164 expect(replacementOffset, completionOffset); |
1239 expect(replacementLength, 1); | 1165 expect(replacementLength, 1); |
1240 assertSuggestField('b', null); | 1166 assertSuggestField('b', null); |
1241 assertSuggestField('_c', 'X'); | 1167 assertSuggestField('_c', 'X'); |
1242 assertNotSuggested('Object'); | 1168 assertNotSuggested('Object'); |
1243 assertNotSuggested('A'); | 1169 assertNotSuggested('A'); |
1244 assertNotSuggested('B'); | 1170 assertNotSuggested('B'); |
1245 assertNotSuggested('X'); | 1171 assertNotSuggested('X'); |
1246 assertNotSuggested('z'); | 1172 assertNotSuggested('z'); |
1247 assertNotSuggested('=='); | 1173 assertNotSuggested('=='); |
1248 } | 1174 } |
1249 | 1175 |
1250 test_CascadeExpression_selector2_withTrailingReturn() async { | 1176 test_CascadeExpression_selector2_withTrailingReturn() async { |
1251 // PropertyAccess CascadeExpression ExpressionStatement Block | 1177 // PropertyAccess CascadeExpression ExpressionStatement Block |
1252 addSource( | 1178 addSource('/testB.dart', ''' |
1253 '/testB.dart', | |
1254 ''' | |
1255 class B { }'''); | 1179 class B { }'''); |
1256 addTestSource(''' | 1180 addTestSource(''' |
1257 import "testB.dart"; | 1181 import "testB.dart"; |
1258 class A {var b; X _c;} | 1182 class A {var b; X _c;} |
1259 class X{} | 1183 class X{} |
1260 main() {A a; a..^ return}'''); | 1184 main() {A a; a..^ return}'''); |
1261 await computeSuggestions(); | 1185 await computeSuggestions(); |
1262 expect(replacementOffset, completionOffset); | 1186 expect(replacementOffset, completionOffset); |
1263 expect(replacementLength, 0); | 1187 expect(replacementLength, 0); |
1264 assertSuggestField('b', null); | 1188 assertSuggestField('b', null); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 expect(replacementLength, 0); | 1257 expect(replacementLength, 0); |
1334 assertNotSuggested('e'); | 1258 assertNotSuggested('e'); |
1335 assertNotSuggested('s'); | 1259 assertNotSuggested('s'); |
1336 assertNotSuggested('a'); | 1260 assertNotSuggested('a'); |
1337 assertNotSuggested('Object'); | 1261 assertNotSuggested('Object'); |
1338 assertNotSuggested('x'); | 1262 assertNotSuggested('x'); |
1339 } | 1263 } |
1340 | 1264 |
1341 test_ClassDeclaration_body() async { | 1265 test_ClassDeclaration_body() async { |
1342 // ClassDeclaration CompilationUnit | 1266 // ClassDeclaration CompilationUnit |
1343 addSource( | 1267 addSource('/testB.dart', ''' |
1344 '/testB.dart', | |
1345 ''' | |
1346 class B { }'''); | 1268 class B { }'''); |
1347 addTestSource(''' | 1269 addTestSource(''' |
1348 import "testB.dart" as x; | 1270 import "testB.dart" as x; |
1349 @deprecated class A {^} | 1271 @deprecated class A {^} |
1350 class _B {} | 1272 class _B {} |
1351 A T;'''); | 1273 A T;'''); |
1352 await computeSuggestions(); | 1274 await computeSuggestions(); |
1353 expect(replacementOffset, completionOffset); | 1275 expect(replacementOffset, completionOffset); |
1354 expect(replacementLength, 0); | 1276 expect(replacementLength, 0); |
1355 assertNotSuggested('A'); | 1277 assertNotSuggested('A'); |
1356 assertNotSuggested('_B'); | 1278 assertNotSuggested('_B'); |
1357 assertNotSuggested('Object'); | 1279 assertNotSuggested('Object'); |
1358 assertNotSuggested('T'); | 1280 assertNotSuggested('T'); |
1359 assertNotSuggested('x'); | 1281 assertNotSuggested('x'); |
1360 } | 1282 } |
1361 | 1283 |
1362 test_ClassDeclaration_body_final() async { | 1284 test_ClassDeclaration_body_final() async { |
1363 // ClassDeclaration CompilationUnit | 1285 // ClassDeclaration CompilationUnit |
1364 addSource( | 1286 addSource('/testB.dart', ''' |
1365 '/testB.dart', | |
1366 ''' | |
1367 class B { }'''); | 1287 class B { }'''); |
1368 addTestSource(''' | 1288 addTestSource(''' |
1369 import "testB.dart" as x; | 1289 import "testB.dart" as x; |
1370 class A {final ^} | 1290 class A {final ^} |
1371 class _B {} | 1291 class _B {} |
1372 A T;'''); | 1292 A T;'''); |
1373 await computeSuggestions(); | 1293 await computeSuggestions(); |
1374 expect(replacementOffset, completionOffset); | 1294 expect(replacementOffset, completionOffset); |
1375 expect(replacementLength, 0); | 1295 expect(replacementLength, 0); |
1376 assertNotSuggested('A'); | 1296 assertNotSuggested('A'); |
1377 assertNotSuggested('_B'); | 1297 assertNotSuggested('_B'); |
1378 assertNotSuggested('Object'); | 1298 assertNotSuggested('Object'); |
1379 assertNotSuggested('T'); | 1299 assertNotSuggested('T'); |
1380 assertNotSuggested('x'); | 1300 assertNotSuggested('x'); |
1381 } | 1301 } |
1382 | 1302 |
1383 test_ClassDeclaration_body_final_field() async { | 1303 test_ClassDeclaration_body_final_field() async { |
1384 // ClassDeclaration CompilationUnit | 1304 // ClassDeclaration CompilationUnit |
1385 addSource( | 1305 addSource('/testB.dart', ''' |
1386 '/testB.dart', | |
1387 ''' | |
1388 class B { }'''); | 1306 class B { }'''); |
1389 addTestSource(''' | 1307 addTestSource(''' |
1390 import "testB.dart" as x; | 1308 import "testB.dart" as x; |
1391 class A {final ^ A(){}} | 1309 class A {final ^ A(){}} |
1392 class _B {} | 1310 class _B {} |
1393 A T;'''); | 1311 A T;'''); |
1394 await computeSuggestions(); | 1312 await computeSuggestions(); |
1395 expect(replacementOffset, completionOffset); | 1313 expect(replacementOffset, completionOffset); |
1396 expect(replacementLength, 0); | 1314 expect(replacementLength, 0); |
1397 assertNotSuggested('A'); | 1315 assertNotSuggested('A'); |
1398 assertNotSuggested('_B'); | 1316 assertNotSuggested('_B'); |
1399 assertNotSuggested('String'); | 1317 assertNotSuggested('String'); |
1400 assertNotSuggested('T'); | 1318 assertNotSuggested('T'); |
1401 assertNotSuggested('x'); | 1319 assertNotSuggested('x'); |
1402 } | 1320 } |
1403 | 1321 |
1404 test_ClassDeclaration_body_final_field2() async { | 1322 test_ClassDeclaration_body_final_field2() async { |
1405 // ClassDeclaration CompilationUnit | 1323 // ClassDeclaration CompilationUnit |
1406 addSource( | 1324 addSource('/testB.dart', ''' |
1407 '/testB.dart', | |
1408 ''' | |
1409 class B { }'''); | 1325 class B { }'''); |
1410 addTestSource(''' | 1326 addTestSource(''' |
1411 import "testB.dart" as Soo; | 1327 import "testB.dart" as Soo; |
1412 class A {final S^ A();} | 1328 class A {final S^ A();} |
1413 class _B {} | 1329 class _B {} |
1414 A Sew;'''); | 1330 A Sew;'''); |
1415 await computeSuggestions(); | 1331 await computeSuggestions(); |
1416 expect(replacementOffset, completionOffset - 1); | 1332 expect(replacementOffset, completionOffset - 1); |
1417 expect(replacementLength, 1); | 1333 expect(replacementLength, 1); |
1418 assertNotSuggested('A'); | 1334 assertNotSuggested('A'); |
1419 assertNotSuggested('_B'); | 1335 assertNotSuggested('_B'); |
1420 assertNotSuggested('String'); | 1336 assertNotSuggested('String'); |
1421 assertNotSuggested('Sew'); | 1337 assertNotSuggested('Sew'); |
1422 assertNotSuggested('Soo'); | 1338 assertNotSuggested('Soo'); |
1423 } | 1339 } |
1424 | 1340 |
1425 test_ClassDeclaration_body_final_final() async { | 1341 test_ClassDeclaration_body_final_final() async { |
1426 // ClassDeclaration CompilationUnit | 1342 // ClassDeclaration CompilationUnit |
1427 addSource( | 1343 addSource('/testB.dart', ''' |
1428 '/testB.dart', | |
1429 ''' | |
1430 class B { }'''); | 1344 class B { }'''); |
1431 addTestSource(''' | 1345 addTestSource(''' |
1432 import "testB.dart" as x; | 1346 import "testB.dart" as x; |
1433 class A {final ^ final foo;} | 1347 class A {final ^ final foo;} |
1434 class _B {} | 1348 class _B {} |
1435 A T;'''); | 1349 A T;'''); |
1436 await computeSuggestions(); | 1350 await computeSuggestions(); |
1437 expect(replacementOffset, completionOffset); | 1351 expect(replacementOffset, completionOffset); |
1438 expect(replacementLength, 0); | 1352 expect(replacementLength, 0); |
1439 assertNotSuggested('A'); | 1353 assertNotSuggested('A'); |
1440 assertNotSuggested('_B'); | 1354 assertNotSuggested('_B'); |
1441 assertNotSuggested('Object'); | 1355 assertNotSuggested('Object'); |
1442 assertNotSuggested('T'); | 1356 assertNotSuggested('T'); |
1443 assertNotSuggested('x'); | 1357 assertNotSuggested('x'); |
1444 } | 1358 } |
1445 | 1359 |
1446 test_ClassDeclaration_body_final_var() async { | 1360 test_ClassDeclaration_body_final_var() async { |
1447 // ClassDeclaration CompilationUnit | 1361 // ClassDeclaration CompilationUnit |
1448 addSource( | 1362 addSource('/testB.dart', ''' |
1449 '/testB.dart', | |
1450 ''' | |
1451 class B { }'''); | 1363 class B { }'''); |
1452 addTestSource(''' | 1364 addTestSource(''' |
1453 import "testB.dart" as x; | 1365 import "testB.dart" as x; |
1454 class A {final ^ var foo;} | 1366 class A {final ^ var foo;} |
1455 class _B {} | 1367 class _B {} |
1456 A T;'''); | 1368 A T;'''); |
1457 await computeSuggestions(); | 1369 await computeSuggestions(); |
1458 expect(replacementOffset, completionOffset); | 1370 expect(replacementOffset, completionOffset); |
1459 expect(replacementLength, 0); | 1371 expect(replacementLength, 0); |
1460 assertNotSuggested('A'); | 1372 assertNotSuggested('A'); |
1461 assertNotSuggested('_B'); | 1373 assertNotSuggested('_B'); |
1462 assertNotSuggested('Object'); | 1374 assertNotSuggested('Object'); |
1463 assertNotSuggested('T'); | 1375 assertNotSuggested('T'); |
1464 assertNotSuggested('x'); | 1376 assertNotSuggested('x'); |
1465 } | 1377 } |
1466 | 1378 |
1467 test_Combinator_hide() async { | 1379 test_Combinator_hide() async { |
1468 // SimpleIdentifier HideCombinator ImportDirective | 1380 // SimpleIdentifier HideCombinator ImportDirective |
1469 addSource( | 1381 addSource('/testAB.dart', ''' |
1470 '/testAB.dart', | |
1471 ''' | |
1472 library libAB; | 1382 library libAB; |
1473 part '/partAB.dart'; | 1383 part '/partAB.dart'; |
1474 class A { } | 1384 class A { } |
1475 class B { }'''); | 1385 class B { }'''); |
1476 addSource( | 1386 addSource('/partAB.dart', ''' |
1477 '/partAB.dart', | |
1478 ''' | |
1479 part of libAB; | 1387 part of libAB; |
1480 var T1; | 1388 var T1; |
1481 PB F1() => new PB(); | 1389 PB F1() => new PB(); |
1482 class PB { }'''); | 1390 class PB { }'''); |
1483 addSource( | 1391 addSource('/testCD.dart', ''' |
1484 '/testCD.dart', | |
1485 ''' | |
1486 class C { } | 1392 class C { } |
1487 class D { }'''); | 1393 class D { }'''); |
1488 addTestSource(''' | 1394 addTestSource(''' |
1489 import "testAB.dart" hide ^; | 1395 import "testAB.dart" hide ^; |
1490 import "testCD.dart"; | 1396 import "testCD.dart"; |
1491 class X {}'''); | 1397 class X {}'''); |
1492 await computeSuggestions(); | 1398 await computeSuggestions(); |
1493 assertNoSuggestions(); | 1399 assertNoSuggestions(); |
1494 } | 1400 } |
1495 | 1401 |
1496 test_Combinator_show() async { | 1402 test_Combinator_show() async { |
1497 // SimpleIdentifier HideCombinator ImportDirective | 1403 // SimpleIdentifier HideCombinator ImportDirective |
1498 addSource( | 1404 addSource('/testAB.dart', ''' |
1499 '/testAB.dart', | |
1500 ''' | |
1501 library libAB; | 1405 library libAB; |
1502 part '/partAB.dart'; | 1406 part '/partAB.dart'; |
1503 class A { } | 1407 class A { } |
1504 class B { }'''); | 1408 class B { }'''); |
1505 addSource( | 1409 addSource('/partAB.dart', ''' |
1506 '/partAB.dart', | |
1507 ''' | |
1508 part of libAB; | 1410 part of libAB; |
1509 var T1; | 1411 var T1; |
1510 PB F1() => new PB(); | 1412 PB F1() => new PB(); |
1511 typedef PB2 F2(int blat); | 1413 typedef PB2 F2(int blat); |
1512 class Clz = Object with Object; | 1414 class Clz = Object with Object; |
1513 class PB { }'''); | 1415 class PB { }'''); |
1514 addSource( | 1416 addSource('/testCD.dart', ''' |
1515 '/testCD.dart', | |
1516 ''' | |
1517 class C { } | 1417 class C { } |
1518 class D { }'''); | 1418 class D { }'''); |
1519 addTestSource(''' | 1419 addTestSource(''' |
1520 import "testAB.dart" show ^; | 1420 import "testAB.dart" show ^; |
1521 import "testCD.dart"; | 1421 import "testCD.dart"; |
1522 class X {}'''); | 1422 class X {}'''); |
1523 await computeSuggestions(); | 1423 await computeSuggestions(); |
1524 assertNoSuggestions(); | 1424 assertNoSuggestions(); |
1525 } | 1425 } |
1526 | 1426 |
1527 test_ConditionalExpression_elseExpression() async { | 1427 test_ConditionalExpression_elseExpression() async { |
1528 // SimpleIdentifier ConditionalExpression ReturnStatement | 1428 // SimpleIdentifier ConditionalExpression ReturnStatement |
1529 addSource( | 1429 addSource('/testA.dart', ''' |
1530 '/testA.dart', | |
1531 ''' | |
1532 int T1; | 1430 int T1; |
1533 F1() { } | 1431 F1() { } |
1534 class A {int x;}'''); | 1432 class A {int x;}'''); |
1535 addTestSource(''' | 1433 addTestSource(''' |
1536 import "testA.dart"; | 1434 import "testA.dart"; |
1537 int T2; | 1435 int T2; |
1538 F2() { } | 1436 F2() { } |
1539 class B {int x;} | 1437 class B {int x;} |
1540 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); | 1438 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); |
1541 await computeSuggestions(); | 1439 await computeSuggestions(); |
1542 // top level results are partially filtered based on first char | 1440 // top level results are partially filtered based on first char |
1543 assertNotSuggested('T2'); | 1441 assertNotSuggested('T2'); |
1544 // TODO (danrubel) getter is being suggested instead of top level var | 1442 // TODO (danrubel) getter is being suggested instead of top level var |
1545 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1443 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1546 } | 1444 } |
1547 | 1445 |
1548 test_ConditionalExpression_elseExpression_empty() async { | 1446 test_ConditionalExpression_elseExpression_empty() async { |
1549 // SimpleIdentifier ConditionalExpression ReturnStatement | 1447 // SimpleIdentifier ConditionalExpression ReturnStatement |
1550 addSource( | 1448 addSource('/testA.dart', ''' |
1551 '/testA.dart', | |
1552 ''' | |
1553 int T1; | 1449 int T1; |
1554 F1() { } | 1450 F1() { } |
1555 class A {int x;}'''); | 1451 class A {int x;}'''); |
1556 addTestSource(''' | 1452 addTestSource(''' |
1557 import "testA.dart"; | 1453 import "testA.dart"; |
1558 int T2; | 1454 int T2; |
1559 F2() { } | 1455 F2() { } |
1560 class B {int x;} | 1456 class B {int x;} |
1561 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); | 1457 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); |
1562 await computeSuggestions(); | 1458 await computeSuggestions(); |
1563 assertNotSuggested('x'); | 1459 assertNotSuggested('x'); |
1564 assertNotSuggested('f'); | 1460 assertNotSuggested('f'); |
1565 assertNotSuggested('foo'); | 1461 assertNotSuggested('foo'); |
1566 assertNotSuggested('C'); | 1462 assertNotSuggested('C'); |
1567 assertNotSuggested('F2'); | 1463 assertNotSuggested('F2'); |
1568 assertNotSuggested('T2'); | 1464 assertNotSuggested('T2'); |
1569 assertNotSuggested('A'); | 1465 assertNotSuggested('A'); |
1570 assertNotSuggested('F1'); | 1466 assertNotSuggested('F1'); |
1571 // TODO (danrubel) getter is being suggested instead of top level var | 1467 // TODO (danrubel) getter is being suggested instead of top level var |
1572 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1468 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1573 } | 1469 } |
1574 | 1470 |
1575 test_ConditionalExpression_partial_thenExpression() async { | 1471 test_ConditionalExpression_partial_thenExpression() async { |
1576 // SimpleIdentifier ConditionalExpression ReturnStatement | 1472 // SimpleIdentifier ConditionalExpression ReturnStatement |
1577 addSource( | 1473 addSource('/testA.dart', ''' |
1578 '/testA.dart', | |
1579 ''' | |
1580 int T1; | 1474 int T1; |
1581 F1() { } | 1475 F1() { } |
1582 class A {int x;}'''); | 1476 class A {int x;}'''); |
1583 addTestSource(''' | 1477 addTestSource(''' |
1584 import "testA.dart"; | 1478 import "testA.dart"; |
1585 int T2; | 1479 int T2; |
1586 F2() { } | 1480 F2() { } |
1587 class B {int x;} | 1481 class B {int x;} |
1588 class C {foo(){var f; {var x;} return a ? T^}}'''); | 1482 class C {foo(){var f; {var x;} return a ? T^}}'''); |
1589 await computeSuggestions(); | 1483 await computeSuggestions(); |
1590 // top level results are partially filtered based on first char | 1484 // top level results are partially filtered based on first char |
1591 assertNotSuggested('T2'); | 1485 assertNotSuggested('T2'); |
1592 // TODO (danrubel) getter is being suggested instead of top level var | 1486 // TODO (danrubel) getter is being suggested instead of top level var |
1593 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1487 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1594 } | 1488 } |
1595 | 1489 |
1596 test_ConditionalExpression_partial_thenExpression_empty() async { | 1490 test_ConditionalExpression_partial_thenExpression_empty() async { |
1597 // SimpleIdentifier ConditionalExpression ReturnStatement | 1491 // SimpleIdentifier ConditionalExpression ReturnStatement |
1598 addSource( | 1492 addSource('/testA.dart', ''' |
1599 '/testA.dart', | |
1600 ''' | |
1601 int T1; | 1493 int T1; |
1602 F1() { } | 1494 F1() { } |
1603 class A {int x;}'''); | 1495 class A {int x;}'''); |
1604 addTestSource(''' | 1496 addTestSource(''' |
1605 import "testA.dart"; | 1497 import "testA.dart"; |
1606 int T2; | 1498 int T2; |
1607 F2() { } | 1499 F2() { } |
1608 class B {int x;} | 1500 class B {int x;} |
1609 class C {foo(){var f; {var x;} return a ? ^}}'''); | 1501 class C {foo(){var f; {var x;} return a ? ^}}'''); |
1610 await computeSuggestions(); | 1502 await computeSuggestions(); |
1611 assertNotSuggested('x'); | 1503 assertNotSuggested('x'); |
1612 assertNotSuggested('f'); | 1504 assertNotSuggested('f'); |
1613 assertNotSuggested('foo'); | 1505 assertNotSuggested('foo'); |
1614 assertNotSuggested('C'); | 1506 assertNotSuggested('C'); |
1615 assertNotSuggested('F2'); | 1507 assertNotSuggested('F2'); |
1616 assertNotSuggested('T2'); | 1508 assertNotSuggested('T2'); |
1617 assertNotSuggested('A'); | 1509 assertNotSuggested('A'); |
1618 assertNotSuggested('F1'); | 1510 assertNotSuggested('F1'); |
1619 // TODO (danrubel) getter is being suggested instead of top level var | 1511 // TODO (danrubel) getter is being suggested instead of top level var |
1620 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1512 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1621 } | 1513 } |
1622 | 1514 |
1623 test_ConditionalExpression_thenExpression() async { | 1515 test_ConditionalExpression_thenExpression() async { |
1624 // SimpleIdentifier ConditionalExpression ReturnStatement | 1516 // SimpleIdentifier ConditionalExpression ReturnStatement |
1625 addSource( | 1517 addSource('/testA.dart', ''' |
1626 '/testA.dart', | |
1627 ''' | |
1628 int T1; | 1518 int T1; |
1629 F1() { } | 1519 F1() { } |
1630 class A {int x;}'''); | 1520 class A {int x;}'''); |
1631 addTestSource(''' | 1521 addTestSource(''' |
1632 import "testA.dart"; | 1522 import "testA.dart"; |
1633 int T2; | 1523 int T2; |
1634 F2() { } | 1524 F2() { } |
1635 class B {int x;} | 1525 class B {int x;} |
1636 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); | 1526 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); |
1637 await computeSuggestions(); | 1527 await computeSuggestions(); |
1638 // top level results are partially filtered based on first char | 1528 // top level results are partially filtered based on first char |
1639 assertNotSuggested('T2'); | 1529 assertNotSuggested('T2'); |
1640 // TODO (danrubel) getter is being suggested instead of top level var | 1530 // TODO (danrubel) getter is being suggested instead of top level var |
1641 //assertSuggestImportedTopLevelVar('T1', 'int'); | 1531 //assertSuggestImportedTopLevelVar('T1', 'int'); |
1642 } | 1532 } |
1643 | 1533 |
1644 test_ConstructorName_importedClass() async { | 1534 test_ConstructorName_importedClass() async { |
1645 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1535 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1646 // InstanceCreationExpression | 1536 // InstanceCreationExpression |
1647 addSource( | 1537 addSource('/testB.dart', ''' |
1648 '/testB.dart', | |
1649 ''' | |
1650 lib B; | 1538 lib B; |
1651 int T1; | 1539 int T1; |
1652 F1() { } | 1540 F1() { } |
1653 class X {X.c(); X._d(); z() {}}'''); | 1541 class X {X.c(); X._d(); z() {}}'''); |
1654 addTestSource(''' | 1542 addTestSource(''' |
1655 import "testB.dart"; | 1543 import "testB.dart"; |
1656 var m; | 1544 var m; |
1657 main() {new X.^}'''); | 1545 main() {new X.^}'''); |
1658 await computeSuggestions(); | 1546 await computeSuggestions(); |
1659 expect(replacementOffset, completionOffset); | 1547 expect(replacementOffset, completionOffset); |
1660 expect(replacementLength, 0); | 1548 expect(replacementLength, 0); |
1661 // Suggested by NamedConstructorContributor | 1549 // Suggested by NamedConstructorContributor |
1662 assertNotSuggested('c'); | 1550 assertNotSuggested('c'); |
1663 assertNotSuggested('F1'); | 1551 assertNotSuggested('F1'); |
1664 assertNotSuggested('T1'); | 1552 assertNotSuggested('T1'); |
1665 assertNotSuggested('_d'); | 1553 assertNotSuggested('_d'); |
1666 assertNotSuggested('z'); | 1554 assertNotSuggested('z'); |
1667 assertNotSuggested('m'); | 1555 assertNotSuggested('m'); |
1668 } | 1556 } |
1669 | 1557 |
1670 test_ConstructorName_importedFactory() async { | 1558 test_ConstructorName_importedFactory() async { |
1671 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1559 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1672 // InstanceCreationExpression | 1560 // InstanceCreationExpression |
1673 addSource( | 1561 addSource('/testB.dart', ''' |
1674 '/testB.dart', | |
1675 ''' | |
1676 lib B; | 1562 lib B; |
1677 int T1; | 1563 int T1; |
1678 F1() { } | 1564 F1() { } |
1679 class X {factory X.c(); factory X._d(); z() {}}'''); | 1565 class X {factory X.c(); factory X._d(); z() {}}'''); |
1680 addTestSource(''' | 1566 addTestSource(''' |
1681 import "testB.dart"; | 1567 import "testB.dart"; |
1682 var m; | 1568 var m; |
1683 main() {new X.^}'''); | 1569 main() {new X.^}'''); |
1684 await computeSuggestions(); | 1570 await computeSuggestions(); |
1685 expect(replacementOffset, completionOffset); | 1571 expect(replacementOffset, completionOffset); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 await computeSuggestions(); | 1711 await computeSuggestions(); |
1826 assertNotSuggested('E'); | 1712 assertNotSuggested('E'); |
1827 assertNotSuggested('one'); | 1713 assertNotSuggested('one'); |
1828 assertNotSuggested('two'); | 1714 assertNotSuggested('two'); |
1829 assertSuggestField('index', 'int'); | 1715 assertSuggestField('index', 'int'); |
1830 assertNotSuggested('values'); | 1716 assertNotSuggested('values'); |
1831 } | 1717 } |
1832 | 1718 |
1833 test_ExpressionStatement_identifier() async { | 1719 test_ExpressionStatement_identifier() async { |
1834 // SimpleIdentifier ExpressionStatement Block | 1720 // SimpleIdentifier ExpressionStatement Block |
1835 addSource( | 1721 addSource('/testA.dart', ''' |
1836 '/testA.dart', | |
1837 ''' | |
1838 _B F1() { } | 1722 _B F1() { } |
1839 class A {int x;} | 1723 class A {int x;} |
1840 class _B { }'''); | 1724 class _B { }'''); |
1841 addTestSource(''' | 1725 addTestSource(''' |
1842 import "testA.dart"; | 1726 import "testA.dart"; |
1843 typedef int F2(int blat); | 1727 typedef int F2(int blat); |
1844 class Clz = Object with Object; | 1728 class Clz = Object with Object; |
1845 class C {foo(){^} void bar() {}}'''); | 1729 class C {foo(){^} void bar() {}}'''); |
1846 await computeSuggestions(); | 1730 await computeSuggestions(); |
1847 expect(replacementOffset, completionOffset); | 1731 expect(replacementOffset, completionOffset); |
1848 expect(replacementLength, 0); | 1732 expect(replacementLength, 0); |
1849 assertNotSuggested('A'); | 1733 assertNotSuggested('A'); |
1850 assertNotSuggested('F1'); | 1734 assertNotSuggested('F1'); |
1851 assertNotSuggested('C'); | 1735 assertNotSuggested('C'); |
1852 assertNotSuggested('foo'); | 1736 assertNotSuggested('foo'); |
1853 assertNotSuggested('bar'); | 1737 assertNotSuggested('bar'); |
1854 assertNotSuggested('F2'); | 1738 assertNotSuggested('F2'); |
1855 assertNotSuggested('Clz'); | 1739 assertNotSuggested('Clz'); |
1856 assertNotSuggested('C'); | 1740 assertNotSuggested('C'); |
1857 assertNotSuggested('x'); | 1741 assertNotSuggested('x'); |
1858 assertNotSuggested('_B'); | 1742 assertNotSuggested('_B'); |
1859 } | 1743 } |
1860 | 1744 |
1861 test_ExpressionStatement_name() async { | 1745 test_ExpressionStatement_name() async { |
1862 // ExpressionStatement Block BlockFunctionBody MethodDeclaration | 1746 // ExpressionStatement Block BlockFunctionBody MethodDeclaration |
1863 addSource( | 1747 addSource('/testA.dart', ''' |
1864 '/testA.dart', | |
1865 ''' | |
1866 B T1; | 1748 B T1; |
1867 class B{}'''); | 1749 class B{}'''); |
1868 addTestSource(''' | 1750 addTestSource(''' |
1869 import "testA.dart"; | 1751 import "testA.dart"; |
1870 class C {a() {C ^}}'''); | 1752 class C {a() {C ^}}'''); |
1871 await computeSuggestions(); | 1753 await computeSuggestions(); |
1872 assertNoSuggestions(); | 1754 assertNoSuggestions(); |
1873 } | 1755 } |
1874 | 1756 |
1875 test_FieldDeclaration_name_typed() async { | 1757 test_FieldDeclaration_name_typed() async { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 await computeSuggestions(); | 1913 await computeSuggestions(); |
2032 expect(replacementOffset, completionOffset - 1); | 1914 expect(replacementOffset, completionOffset - 1); |
2033 expect(replacementLength, 1); | 1915 expect(replacementLength, 1); |
2034 assertNotSuggested('index'); | 1916 assertNotSuggested('index'); |
2035 assertNotSuggested('main'); | 1917 assertNotSuggested('main'); |
2036 assertNotSuggested('bar'); | 1918 assertNotSuggested('bar'); |
2037 } | 1919 } |
2038 | 1920 |
2039 test_FunctionDeclaration_returnType_afterComment() async { | 1921 test_FunctionDeclaration_returnType_afterComment() async { |
2040 // ClassDeclaration CompilationUnit | 1922 // ClassDeclaration CompilationUnit |
2041 addSource( | 1923 addSource('/testA.dart', ''' |
2042 '/testA.dart', | |
2043 ''' | |
2044 int T1; | 1924 int T1; |
2045 F1() { } | 1925 F1() { } |
2046 typedef D1(); | 1926 typedef D1(); |
2047 class C1 {C1(this.x) { } int x;}'''); | 1927 class C1 {C1(this.x) { } int x;}'''); |
2048 addTestSource(''' | 1928 addTestSource(''' |
2049 import "testA.dart"; | 1929 import "testA.dart"; |
2050 int T2; | 1930 int T2; |
2051 F2() { } | 1931 F2() { } |
2052 typedef D2(); | 1932 typedef D2(); |
2053 class C2 { } | 1933 class C2 { } |
2054 /* */ ^ zoo(z) { } String name;'''); | 1934 /* */ ^ zoo(z) { } String name;'''); |
2055 await computeSuggestions(); | 1935 await computeSuggestions(); |
2056 expect(replacementOffset, completionOffset); | 1936 expect(replacementOffset, completionOffset); |
2057 expect(replacementLength, 0); | 1937 expect(replacementLength, 0); |
2058 assertNotSuggested('Object'); | 1938 assertNotSuggested('Object'); |
2059 assertNotSuggested('T1'); | 1939 assertNotSuggested('T1'); |
2060 assertNotSuggested('F1'); | 1940 assertNotSuggested('F1'); |
2061 assertNotSuggested('D1'); | 1941 assertNotSuggested('D1'); |
2062 assertNotSuggested('C1'); | 1942 assertNotSuggested('C1'); |
2063 assertNotSuggested('T2'); | 1943 assertNotSuggested('T2'); |
2064 assertNotSuggested('F2'); | 1944 assertNotSuggested('F2'); |
2065 assertNotSuggested('D2'); | 1945 assertNotSuggested('D2'); |
2066 assertNotSuggested('C2'); | 1946 assertNotSuggested('C2'); |
2067 assertNotSuggested('name'); | 1947 assertNotSuggested('name'); |
2068 } | 1948 } |
2069 | 1949 |
2070 test_FunctionDeclaration_returnType_afterComment2() async { | 1950 test_FunctionDeclaration_returnType_afterComment2() async { |
2071 // FunctionDeclaration ClassDeclaration CompilationUnit | 1951 // FunctionDeclaration ClassDeclaration CompilationUnit |
2072 addSource( | 1952 addSource('/testA.dart', ''' |
2073 '/testA.dart', | |
2074 ''' | |
2075 int T1; | 1953 int T1; |
2076 F1() { } | 1954 F1() { } |
2077 typedef D1(); | 1955 typedef D1(); |
2078 class C1 {C1(this.x) { } int x;}'''); | 1956 class C1 {C1(this.x) { } int x;}'''); |
2079 addTestSource(''' | 1957 addTestSource(''' |
2080 import "testA.dart"; | 1958 import "testA.dart"; |
2081 int T2; | 1959 int T2; |
2082 F2() { } | 1960 F2() { } |
2083 typedef D2(); | 1961 typedef D2(); |
2084 class C2 { } | 1962 class C2 { } |
2085 /** */ ^ zoo(z) { } String name;'''); | 1963 /** */ ^ zoo(z) { } String name;'''); |
2086 await computeSuggestions(); | 1964 await computeSuggestions(); |
2087 expect(replacementOffset, completionOffset); | 1965 expect(replacementOffset, completionOffset); |
2088 expect(replacementLength, 0); | 1966 expect(replacementLength, 0); |
2089 assertNotSuggested('Object'); | 1967 assertNotSuggested('Object'); |
2090 assertNotSuggested('T1'); | 1968 assertNotSuggested('T1'); |
2091 assertNotSuggested('F1'); | 1969 assertNotSuggested('F1'); |
2092 assertNotSuggested('D1'); | 1970 assertNotSuggested('D1'); |
2093 assertNotSuggested('C1'); | 1971 assertNotSuggested('C1'); |
2094 assertNotSuggested('T2'); | 1972 assertNotSuggested('T2'); |
2095 assertNotSuggested('F2'); | 1973 assertNotSuggested('F2'); |
2096 assertNotSuggested('D2'); | 1974 assertNotSuggested('D2'); |
2097 assertNotSuggested('C2'); | 1975 assertNotSuggested('C2'); |
2098 assertNotSuggested('name'); | 1976 assertNotSuggested('name'); |
2099 } | 1977 } |
2100 | 1978 |
2101 test_FunctionDeclaration_returnType_afterComment3() async { | 1979 test_FunctionDeclaration_returnType_afterComment3() async { |
2102 // FunctionDeclaration ClassDeclaration CompilationUnit | 1980 // FunctionDeclaration ClassDeclaration CompilationUnit |
2103 addSource( | 1981 addSource('/testA.dart', ''' |
2104 '/testA.dart', | |
2105 ''' | |
2106 int T1; | 1982 int T1; |
2107 F1() { } | 1983 F1() { } |
2108 typedef D1(); | 1984 typedef D1(); |
2109 class C1 {C1(this.x) { } int x;}'''); | 1985 class C1 {C1(this.x) { } int x;}'''); |
2110 addTestSource(''' | 1986 addTestSource(''' |
2111 import "testA.dart"; | 1987 import "testA.dart"; |
2112 int T2; | 1988 int T2; |
2113 F2() { } | 1989 F2() { } |
2114 typedef D2(); | 1990 typedef D2(); |
2115 /// some dartdoc | 1991 /// some dartdoc |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2264 // SimpleStringLiteral ImportDirective | 2140 // SimpleStringLiteral ImportDirective |
2265 addTestSource(''' | 2141 addTestSource(''' |
2266 import "dart^"; | 2142 import "dart^"; |
2267 main() {}'''); | 2143 main() {}'''); |
2268 await computeSuggestions(); | 2144 await computeSuggestions(); |
2269 assertNoSuggestions(); | 2145 assertNoSuggestions(); |
2270 } | 2146 } |
2271 | 2147 |
2272 test_IndexExpression() async { | 2148 test_IndexExpression() async { |
2273 // ExpressionStatement Block | 2149 // ExpressionStatement Block |
2274 addSource( | 2150 addSource('/testA.dart', ''' |
2275 '/testA.dart', | |
2276 ''' | |
2277 int T1; | 2151 int T1; |
2278 F1() { } | 2152 F1() { } |
2279 class A {int x;}'''); | 2153 class A {int x;}'''); |
2280 addTestSource(''' | 2154 addTestSource(''' |
2281 import "testA.dart"; | 2155 import "testA.dart"; |
2282 int T2; | 2156 int T2; |
2283 F2() { } | 2157 F2() { } |
2284 class B {int x;} | 2158 class B {int x;} |
2285 class C {foo(){var f; {var x;} f[^]}}'''); | 2159 class C {foo(){var f; {var x;} f[^]}}'''); |
2286 await computeSuggestions(); | 2160 await computeSuggestions(); |
2287 assertNotSuggested('x'); | 2161 assertNotSuggested('x'); |
2288 assertNotSuggested('f'); | 2162 assertNotSuggested('f'); |
2289 assertNotSuggested('foo'); | 2163 assertNotSuggested('foo'); |
2290 assertNotSuggested('C'); | 2164 assertNotSuggested('C'); |
2291 assertNotSuggested('F2'); | 2165 assertNotSuggested('F2'); |
2292 assertNotSuggested('T2'); | 2166 assertNotSuggested('T2'); |
2293 assertNotSuggested('A'); | 2167 assertNotSuggested('A'); |
2294 assertNotSuggested('F1'); | 2168 assertNotSuggested('F1'); |
2295 // TODO (danrubel) getter is being suggested instead of top level var | 2169 // TODO (danrubel) getter is being suggested instead of top level var |
2296 //assertSuggestImportedTopLevelVar('T1', 'int'); | 2170 //assertSuggestImportedTopLevelVar('T1', 'int'); |
2297 } | 2171 } |
2298 | 2172 |
2299 test_IndexExpression2() async { | 2173 test_IndexExpression2() async { |
2300 // SimpleIdentifier IndexExpression ExpressionStatement Block | 2174 // SimpleIdentifier IndexExpression ExpressionStatement Block |
2301 addSource( | 2175 addSource('/testA.dart', ''' |
2302 '/testA.dart', | |
2303 ''' | |
2304 int T1; | 2176 int T1; |
2305 F1() { } | 2177 F1() { } |
2306 class A {int x;}'''); | 2178 class A {int x;}'''); |
2307 addTestSource(''' | 2179 addTestSource(''' |
2308 import "testA.dart"; | 2180 import "testA.dart"; |
2309 int T2; | 2181 int T2; |
2310 F2() { } | 2182 F2() { } |
2311 class B {int x;} | 2183 class B {int x;} |
2312 class C {foo(){var f; {var x;} f[T^]}}'''); | 2184 class C {foo(){var f; {var x;} f[T^]}}'''); |
2313 await computeSuggestions(); | 2185 await computeSuggestions(); |
2314 // top level results are partially filtered based on first char | 2186 // top level results are partially filtered based on first char |
2315 assertNotSuggested('T2'); | 2187 assertNotSuggested('T2'); |
2316 // TODO (danrubel) getter is being suggested instead of top level var | 2188 // TODO (danrubel) getter is being suggested instead of top level var |
2317 //assertSuggestImportedTopLevelVar('T1', 'int'); | 2189 //assertSuggestImportedTopLevelVar('T1', 'int'); |
2318 } | 2190 } |
2319 | 2191 |
2320 test_InstanceCreationExpression_imported() async { | 2192 test_InstanceCreationExpression_imported() async { |
2321 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression | 2193 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
2322 addSource( | 2194 addSource('/testA.dart', ''' |
2323 '/testA.dart', | |
2324 ''' | |
2325 int T1; | 2195 int T1; |
2326 F1() { } | 2196 F1() { } |
2327 class A {A(this.x) { } int x;}'''); | 2197 class A {A(this.x) { } int x;}'''); |
2328 addTestSource(''' | 2198 addTestSource(''' |
2329 import "testA.dart"; | 2199 import "testA.dart"; |
2330 import "dart:async"; | 2200 import "dart:async"; |
2331 int T2; | 2201 int T2; |
2332 F2() { } | 2202 F2() { } |
2333 class B {B(this.x, [String boo]) { } int x;} | 2203 class B {B(this.x, [String boo]) { } int x;} |
2334 class C {foo(){var f; {var x;} new ^}}'''); | 2204 class C {foo(){var f; {var x;} new ^}}'''); |
(...skipping 20 matching lines...) Expand all Loading... |
2355 addTestSource('class C {foo(){new F^}}'); | 2225 addTestSource('class C {foo(){new F^}}'); |
2356 await computeSuggestions(); | 2226 await computeSuggestions(); |
2357 expect(replacementOffset, completionOffset - 1); | 2227 expect(replacementOffset, completionOffset - 1); |
2358 expect(replacementLength, 1); | 2228 expect(replacementLength, 1); |
2359 assertNotSuggested('Future'); | 2229 assertNotSuggested('Future'); |
2360 assertNotSuggested('Foo'); | 2230 assertNotSuggested('Foo'); |
2361 } | 2231 } |
2362 | 2232 |
2363 test_InterpolationExpression() async { | 2233 test_InterpolationExpression() async { |
2364 // SimpleIdentifier InterpolationExpression StringInterpolation | 2234 // SimpleIdentifier InterpolationExpression StringInterpolation |
2365 addSource( | 2235 addSource('/testA.dart', ''' |
2366 '/testA.dart', | |
2367 ''' | |
2368 int T1; | 2236 int T1; |
2369 F1() { } | 2237 F1() { } |
2370 typedef D1(); | 2238 typedef D1(); |
2371 class C1 {C1(this.x) { } int x;}'''); | 2239 class C1 {C1(this.x) { } int x;}'''); |
2372 addTestSource(''' | 2240 addTestSource(''' |
2373 import "testA.dart"; | 2241 import "testA.dart"; |
2374 int T2; | 2242 int T2; |
2375 F2() { } | 2243 F2() { } |
2376 typedef D2(); | 2244 typedef D2(); |
2377 class C2 { } | 2245 class C2 { } |
2378 main() {String name; print("hello \$^");}'''); | 2246 main() {String name; print("hello \$^");}'''); |
2379 await computeSuggestions(); | 2247 await computeSuggestions(); |
2380 expect(replacementOffset, completionOffset); | 2248 expect(replacementOffset, completionOffset); |
2381 expect(replacementLength, 0); | 2249 expect(replacementLength, 0); |
2382 assertNotSuggested('Object'); | 2250 assertNotSuggested('Object'); |
2383 // TODO(danrubel) should return top level var rather than getter | 2251 // TODO(danrubel) should return top level var rather than getter |
2384 assertNotSuggested('F1'); | 2252 assertNotSuggested('F1'); |
2385 assertNotSuggested('D1'); | 2253 assertNotSuggested('D1'); |
2386 assertNotSuggested('C1'); | 2254 assertNotSuggested('C1'); |
2387 assertNotSuggested('T2'); | 2255 assertNotSuggested('T2'); |
2388 assertNotSuggested('F2'); | 2256 assertNotSuggested('F2'); |
2389 assertNotSuggested('D2'); | 2257 assertNotSuggested('D2'); |
2390 assertNotSuggested('C2'); | 2258 assertNotSuggested('C2'); |
2391 assertNotSuggested('name'); | 2259 assertNotSuggested('name'); |
2392 } | 2260 } |
2393 | 2261 |
2394 test_InterpolationExpression_block() async { | 2262 test_InterpolationExpression_block() async { |
2395 // SimpleIdentifier InterpolationExpression StringInterpolation | 2263 // SimpleIdentifier InterpolationExpression StringInterpolation |
2396 addSource( | 2264 addSource('/testA.dart', ''' |
2397 '/testA.dart', | |
2398 ''' | |
2399 int T1; | 2265 int T1; |
2400 F1() { } | 2266 F1() { } |
2401 typedef D1(); | 2267 typedef D1(); |
2402 class C1 {C1(this.x) { } int x;}'''); | 2268 class C1 {C1(this.x) { } int x;}'''); |
2403 addTestSource(''' | 2269 addTestSource(''' |
2404 import "testA.dart"; | 2270 import "testA.dart"; |
2405 int T2; | 2271 int T2; |
2406 F2() { } | 2272 F2() { } |
2407 typedef D2(); | 2273 typedef D2(); |
2408 class C2 { } | 2274 class C2 { } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 addTestSource('main() {String name; print("hello \${nam^e.length}");}'); | 2320 addTestSource('main() {String name; print("hello \${nam^e.length}");}'); |
2455 await computeSuggestions(); | 2321 await computeSuggestions(); |
2456 assertNotSuggested('name'); | 2322 assertNotSuggested('name'); |
2457 // top level results are partially filtered | 2323 // top level results are partially filtered |
2458 //assertNotSuggested('Object'); | 2324 //assertNotSuggested('Object'); |
2459 assertNotSuggested('length'); | 2325 assertNotSuggested('length'); |
2460 } | 2326 } |
2461 | 2327 |
2462 test_IsExpression() async { | 2328 test_IsExpression() async { |
2463 // SimpleIdentifier TypeName IsExpression IfStatement | 2329 // SimpleIdentifier TypeName IsExpression IfStatement |
2464 addSource( | 2330 addSource('/testB.dart', ''' |
2465 '/testB.dart', | |
2466 ''' | |
2467 lib B; | 2331 lib B; |
2468 foo() { } | 2332 foo() { } |
2469 class X {X.c(); X._d(); z() {}}'''); | 2333 class X {X.c(); X._d(); z() {}}'''); |
2470 addTestSource(''' | 2334 addTestSource(''' |
2471 import "testB.dart"; | 2335 import "testB.dart"; |
2472 class Y {Y.c(); Y._d(); z() {}} | 2336 class Y {Y.c(); Y._d(); z() {}} |
2473 main() {var x; if (x is ^) { }}'''); | 2337 main() {var x; if (x is ^) { }}'''); |
2474 await computeSuggestions(); | 2338 await computeSuggestions(); |
2475 expect(replacementOffset, completionOffset); | 2339 expect(replacementOffset, completionOffset); |
2476 expect(replacementLength, 0); | 2340 expect(replacementLength, 0); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 } | 2392 } |
2529 | 2393 |
2530 test_keyword() async { | 2394 test_keyword() async { |
2531 addTestSource('class C { static C get instance => null; } main() {C.in^}'); | 2395 addTestSource('class C { static C get instance => null; } main() {C.in^}'); |
2532 await computeSuggestions(); | 2396 await computeSuggestions(); |
2533 // Suggested by StaticMemberContributor | 2397 // Suggested by StaticMemberContributor |
2534 assertNotSuggested('instance'); | 2398 assertNotSuggested('instance'); |
2535 } | 2399 } |
2536 | 2400 |
2537 test_keyword2() async { | 2401 test_keyword2() async { |
2538 addSource( | 2402 addSource('/testB.dart', ''' |
2539 '/testB.dart', | |
2540 ''' | |
2541 lib B; | 2403 lib B; |
2542 int newT1; | 2404 int newT1; |
2543 int T1; | 2405 int T1; |
2544 nowIsIt() { } | 2406 nowIsIt() { } |
2545 class X {factory X.c(); factory X._d(); z() {}}'''); | 2407 class X {factory X.c(); factory X._d(); z() {}}'''); |
2546 addTestSource(''' | 2408 addTestSource(''' |
2547 import "testB.dart"; | 2409 import "testB.dart"; |
2548 String newer() {} | 2410 String newer() {} |
2549 var m; | 2411 var m; |
2550 main() {new^ X.c();}'''); | 2412 main() {new^ X.c();}'''); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 | 2511 |
2650 test_localVariableDeclarationName() async { | 2512 test_localVariableDeclarationName() async { |
2651 addTestSource('main() {String m^}'); | 2513 addTestSource('main() {String m^}'); |
2652 await computeSuggestions(); | 2514 await computeSuggestions(); |
2653 assertNotSuggested('main'); | 2515 assertNotSuggested('main'); |
2654 assertNotSuggested('min'); | 2516 assertNotSuggested('min'); |
2655 } | 2517 } |
2656 | 2518 |
2657 test_MapLiteralEntry() async { | 2519 test_MapLiteralEntry() async { |
2658 // MapLiteralEntry MapLiteral VariableDeclaration | 2520 // MapLiteralEntry MapLiteral VariableDeclaration |
2659 addSource( | 2521 addSource('/testA.dart', ''' |
2660 '/testA.dart', | |
2661 ''' | |
2662 int T1; | 2522 int T1; |
2663 F1() { } | 2523 F1() { } |
2664 typedef D1(); | 2524 typedef D1(); |
2665 class C1 {C1(this.x) { } int x;}'''); | 2525 class C1 {C1(this.x) { } int x;}'''); |
2666 addTestSource(''' | 2526 addTestSource(''' |
2667 import "testA.dart"; | 2527 import "testA.dart"; |
2668 int T2; | 2528 int T2; |
2669 F2() { } | 2529 F2() { } |
2670 typedef D2(); | 2530 typedef D2(); |
2671 class C2 { } | 2531 class C2 { } |
2672 foo = {^'''); | 2532 foo = {^'''); |
2673 await computeSuggestions(); | 2533 await computeSuggestions(); |
2674 expect(replacementOffset, completionOffset); | 2534 expect(replacementOffset, completionOffset); |
2675 expect(replacementLength, 0); | 2535 expect(replacementLength, 0); |
2676 assertNotSuggested('Object'); | 2536 assertNotSuggested('Object'); |
2677 assertNotSuggested('F1'); | 2537 assertNotSuggested('F1'); |
2678 assertNotSuggested('D1'); | 2538 assertNotSuggested('D1'); |
2679 assertNotSuggested('C1'); | 2539 assertNotSuggested('C1'); |
2680 assertNotSuggested('T2'); | 2540 assertNotSuggested('T2'); |
2681 assertNotSuggested('F2'); | 2541 assertNotSuggested('F2'); |
2682 assertNotSuggested('D2'); | 2542 assertNotSuggested('D2'); |
2683 assertNotSuggested('C2'); | 2543 assertNotSuggested('C2'); |
2684 } | 2544 } |
2685 | 2545 |
2686 test_MapLiteralEntry1() async { | 2546 test_MapLiteralEntry1() async { |
2687 // MapLiteralEntry MapLiteral VariableDeclaration | 2547 // MapLiteralEntry MapLiteral VariableDeclaration |
2688 addSource( | 2548 addSource('/testA.dart', ''' |
2689 '/testA.dart', | |
2690 ''' | |
2691 int T1; | 2549 int T1; |
2692 F1() { } | 2550 F1() { } |
2693 typedef D1(); | 2551 typedef D1(); |
2694 class C1 {C1(this.x) { } int x;}'''); | 2552 class C1 {C1(this.x) { } int x;}'''); |
2695 addTestSource(''' | 2553 addTestSource(''' |
2696 import "testA.dart"; | 2554 import "testA.dart"; |
2697 int T2; | 2555 int T2; |
2698 F2() { } | 2556 F2() { } |
2699 typedef D2(); | 2557 typedef D2(); |
2700 class C2 { } | 2558 class C2 { } |
2701 foo = {T^'''); | 2559 foo = {T^'''); |
2702 await computeSuggestions(); | 2560 await computeSuggestions(); |
2703 expect(replacementOffset, completionOffset - 1); | 2561 expect(replacementOffset, completionOffset - 1); |
2704 expect(replacementLength, 1); | 2562 expect(replacementLength, 1); |
2705 assertNotSuggested('T2'); | 2563 assertNotSuggested('T2'); |
2706 } | 2564 } |
2707 | 2565 |
2708 test_MapLiteralEntry2() async { | 2566 test_MapLiteralEntry2() async { |
2709 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration | 2567 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration |
2710 addSource( | 2568 addSource('/testA.dart', ''' |
2711 '/testA.dart', | |
2712 ''' | |
2713 int T1; | 2569 int T1; |
2714 F1() { } | 2570 F1() { } |
2715 typedef D1(); | 2571 typedef D1(); |
2716 class C1 {C1(this.x) { } int x;}'''); | 2572 class C1 {C1(this.x) { } int x;}'''); |
2717 addTestSource(''' | 2573 addTestSource(''' |
2718 import "testA.dart"; | 2574 import "testA.dart"; |
2719 int T2; | 2575 int T2; |
2720 F2() { } | 2576 F2() { } |
2721 typedef D2(); | 2577 typedef D2(); |
2722 class C2 { } | 2578 class C2 { } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 await computeSuggestions(); | 2688 await computeSuggestions(); |
2833 expect(replacementOffset, completionOffset); | 2689 expect(replacementOffset, completionOffset); |
2834 expect(replacementLength, 0); | 2690 expect(replacementLength, 0); |
2835 assertNotSuggested('a'); | 2691 assertNotSuggested('a'); |
2836 assertNotSuggested('f'); | 2692 assertNotSuggested('f'); |
2837 assertNotSuggested('_g'); | 2693 assertNotSuggested('_g'); |
2838 } | 2694 } |
2839 | 2695 |
2840 test_MethodDeclaration_body_static() async { | 2696 test_MethodDeclaration_body_static() async { |
2841 // Block BlockFunctionBody MethodDeclaration | 2697 // Block BlockFunctionBody MethodDeclaration |
2842 addSource( | 2698 addSource('/testC.dart', ''' |
2843 '/testC.dart', | |
2844 ''' | |
2845 class C { | 2699 class C { |
2846 c1() {} | 2700 c1() {} |
2847 var c2; | 2701 var c2; |
2848 static c3() {} | 2702 static c3() {} |
2849 static var c4;}'''); | 2703 static var c4;}'''); |
2850 addTestSource(''' | 2704 addTestSource(''' |
2851 import "testC.dart"; | 2705 import "testC.dart"; |
2852 class B extends C { | 2706 class B extends C { |
2853 b1() {} | 2707 b1() {} |
2854 var b2; | 2708 var b2; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2913 assertNotSuggested('foo'); | 2767 assertNotSuggested('foo'); |
2914 assertNotSuggested('bar'); | 2768 assertNotSuggested('bar'); |
2915 assertNotSuggested('a'); | 2769 assertNotSuggested('a'); |
2916 assertNotSuggested('x'); | 2770 assertNotSuggested('x'); |
2917 assertNotSuggested('y'); | 2771 assertNotSuggested('y'); |
2918 assertNotSuggested('String'); | 2772 assertNotSuggested('String'); |
2919 } | 2773 } |
2920 | 2774 |
2921 test_MethodDeclaration_returnType() async { | 2775 test_MethodDeclaration_returnType() async { |
2922 // ClassDeclaration CompilationUnit | 2776 // ClassDeclaration CompilationUnit |
2923 addSource( | 2777 addSource('/testA.dart', ''' |
2924 '/testA.dart', | |
2925 ''' | |
2926 int T1; | 2778 int T1; |
2927 F1() { } | 2779 F1() { } |
2928 typedef D1(); | 2780 typedef D1(); |
2929 class C1 {C1(this.x) { } int x;}'''); | 2781 class C1 {C1(this.x) { } int x;}'''); |
2930 addTestSource(''' | 2782 addTestSource(''' |
2931 import "testA.dart"; | 2783 import "testA.dart"; |
2932 int T2; | 2784 int T2; |
2933 F2() { } | 2785 F2() { } |
2934 typedef D2(); | 2786 typedef D2(); |
2935 class C2 {^ zoo(z) { } String name; }'''); | 2787 class C2 {^ zoo(z) { } String name; }'''); |
2936 await computeSuggestions(); | 2788 await computeSuggestions(); |
2937 expect(replacementOffset, completionOffset); | 2789 expect(replacementOffset, completionOffset); |
2938 expect(replacementLength, 0); | 2790 expect(replacementLength, 0); |
2939 assertNotSuggested('Object'); | 2791 assertNotSuggested('Object'); |
2940 assertNotSuggested('T1'); | 2792 assertNotSuggested('T1'); |
2941 assertNotSuggested('F1'); | 2793 assertNotSuggested('F1'); |
2942 assertNotSuggested('D1'); | 2794 assertNotSuggested('D1'); |
2943 assertNotSuggested('C1'); | 2795 assertNotSuggested('C1'); |
2944 assertNotSuggested('T2'); | 2796 assertNotSuggested('T2'); |
2945 assertNotSuggested('F2'); | 2797 assertNotSuggested('F2'); |
2946 assertNotSuggested('D2'); | 2798 assertNotSuggested('D2'); |
2947 assertNotSuggested('C2'); | 2799 assertNotSuggested('C2'); |
2948 assertNotSuggested('name'); | 2800 assertNotSuggested('name'); |
2949 } | 2801 } |
2950 | 2802 |
2951 test_MethodDeclaration_returnType_afterComment() async { | 2803 test_MethodDeclaration_returnType_afterComment() async { |
2952 // ClassDeclaration CompilationUnit | 2804 // ClassDeclaration CompilationUnit |
2953 addSource( | 2805 addSource('/testA.dart', ''' |
2954 '/testA.dart', | |
2955 ''' | |
2956 int T1; | 2806 int T1; |
2957 F1() { } | 2807 F1() { } |
2958 typedef D1(); | 2808 typedef D1(); |
2959 class C1 {C1(this.x) { } int x;}'''); | 2809 class C1 {C1(this.x) { } int x;}'''); |
2960 addTestSource(''' | 2810 addTestSource(''' |
2961 import "testA.dart"; | 2811 import "testA.dart"; |
2962 int T2; | 2812 int T2; |
2963 F2() { } | 2813 F2() { } |
2964 typedef D2(); | 2814 typedef D2(); |
2965 class C2 {/* */ ^ zoo(z) { } String name; }'''); | 2815 class C2 {/* */ ^ zoo(z) { } String name; }'''); |
2966 await computeSuggestions(); | 2816 await computeSuggestions(); |
2967 expect(replacementOffset, completionOffset); | 2817 expect(replacementOffset, completionOffset); |
2968 expect(replacementLength, 0); | 2818 expect(replacementLength, 0); |
2969 assertNotSuggested('Object'); | 2819 assertNotSuggested('Object'); |
2970 assertNotSuggested('T1'); | 2820 assertNotSuggested('T1'); |
2971 assertNotSuggested('F1'); | 2821 assertNotSuggested('F1'); |
2972 assertNotSuggested('D1'); | 2822 assertNotSuggested('D1'); |
2973 assertNotSuggested('C1'); | 2823 assertNotSuggested('C1'); |
2974 assertNotSuggested('T2'); | 2824 assertNotSuggested('T2'); |
2975 assertNotSuggested('F2'); | 2825 assertNotSuggested('F2'); |
2976 assertNotSuggested('D2'); | 2826 assertNotSuggested('D2'); |
2977 assertNotSuggested('C2'); | 2827 assertNotSuggested('C2'); |
2978 assertNotSuggested('name'); | 2828 assertNotSuggested('name'); |
2979 } | 2829 } |
2980 | 2830 |
2981 test_MethodDeclaration_returnType_afterComment2() async { | 2831 test_MethodDeclaration_returnType_afterComment2() async { |
2982 // MethodDeclaration ClassDeclaration CompilationUnit | 2832 // MethodDeclaration ClassDeclaration CompilationUnit |
2983 addSource( | 2833 addSource('/testA.dart', ''' |
2984 '/testA.dart', | |
2985 ''' | |
2986 int T1; | 2834 int T1; |
2987 F1() { } | 2835 F1() { } |
2988 typedef D1(); | 2836 typedef D1(); |
2989 class C1 {C1(this.x) { } int x;}'''); | 2837 class C1 {C1(this.x) { } int x;}'''); |
2990 addTestSource(''' | 2838 addTestSource(''' |
2991 import "testA.dart"; | 2839 import "testA.dart"; |
2992 int T2; | 2840 int T2; |
2993 F2() { } | 2841 F2() { } |
2994 typedef D2(); | 2842 typedef D2(); |
2995 class C2 {/** */ ^ zoo(z) { } String name; }'''); | 2843 class C2 {/** */ ^ zoo(z) { } String name; }'''); |
2996 await computeSuggestions(); | 2844 await computeSuggestions(); |
2997 expect(replacementOffset, completionOffset); | 2845 expect(replacementOffset, completionOffset); |
2998 expect(replacementLength, 0); | 2846 expect(replacementLength, 0); |
2999 assertNotSuggested('Object'); | 2847 assertNotSuggested('Object'); |
3000 assertNotSuggested('T1'); | 2848 assertNotSuggested('T1'); |
3001 assertNotSuggested('F1'); | 2849 assertNotSuggested('F1'); |
3002 assertNotSuggested('D1'); | 2850 assertNotSuggested('D1'); |
3003 assertNotSuggested('C1'); | 2851 assertNotSuggested('C1'); |
3004 assertNotSuggested('T2'); | 2852 assertNotSuggested('T2'); |
3005 assertNotSuggested('F2'); | 2853 assertNotSuggested('F2'); |
3006 assertNotSuggested('D2'); | 2854 assertNotSuggested('D2'); |
3007 assertNotSuggested('C2'); | 2855 assertNotSuggested('C2'); |
3008 assertNotSuggested('name'); | 2856 assertNotSuggested('name'); |
3009 } | 2857 } |
3010 | 2858 |
3011 test_MethodDeclaration_returnType_afterComment3() async { | 2859 test_MethodDeclaration_returnType_afterComment3() async { |
3012 // MethodDeclaration ClassDeclaration CompilationUnit | 2860 // MethodDeclaration ClassDeclaration CompilationUnit |
3013 addSource( | 2861 addSource('/testA.dart', ''' |
3014 '/testA.dart', | |
3015 ''' | |
3016 int T1; | 2862 int T1; |
3017 F1() { } | 2863 F1() { } |
3018 typedef D1(); | 2864 typedef D1(); |
3019 class C1 {C1(this.x) { } int x;}'''); | 2865 class C1 {C1(this.x) { } int x;}'''); |
3020 addTestSource(''' | 2866 addTestSource(''' |
3021 import "testA.dart"; | 2867 import "testA.dart"; |
3022 int T2; | 2868 int T2; |
3023 F2() { } | 2869 F2() { } |
3024 typedef D2(); | 2870 typedef D2(); |
3025 class C2 { | 2871 class C2 { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3202 | 3048 |
3203 test_parameterName_excludeTypes() async { | 3049 test_parameterName_excludeTypes() async { |
3204 addTestSource('m(int ^) {}'); | 3050 addTestSource('m(int ^) {}'); |
3205 await computeSuggestions(); | 3051 await computeSuggestions(); |
3206 assertNotSuggested('int'); | 3052 assertNotSuggested('int'); |
3207 assertNotSuggested('bool'); | 3053 assertNotSuggested('bool'); |
3208 } | 3054 } |
3209 | 3055 |
3210 test_partFile_TypeName() async { | 3056 test_partFile_TypeName() async { |
3211 // SimpleIdentifier TypeName ConstructorName | 3057 // SimpleIdentifier TypeName ConstructorName |
3212 addSource( | 3058 addSource('/testB.dart', ''' |
3213 '/testB.dart', | |
3214 ''' | |
3215 lib B; | 3059 lib B; |
3216 int T1; | 3060 int T1; |
3217 F1() { } | 3061 F1() { } |
3218 class X {X.c(); X._d(); z() {}}'''); | 3062 class X {X.c(); X._d(); z() {}}'''); |
3219 addSource( | 3063 addSource('/testA.dart', ''' |
3220 '/testA.dart', | |
3221 ''' | |
3222 library libA; | 3064 library libA; |
3223 import "testB.dart"; | 3065 import "testB.dart"; |
3224 part "$testFile"; | 3066 part "$testFile"; |
3225 class A { } | 3067 class A { } |
3226 var m;'''); | 3068 var m;'''); |
3227 addTestSource(''' | 3069 addTestSource(''' |
3228 part of libA; | 3070 part of libA; |
3229 class B { factory B.bar(int x) => null; } | 3071 class B { factory B.bar(int x) => null; } |
3230 main() {new ^}'''); | 3072 main() {new ^}'''); |
3231 await computeSuggestions(); | 3073 await computeSuggestions(); |
3232 expect(replacementOffset, completionOffset); | 3074 expect(replacementOffset, completionOffset); |
3233 expect(replacementLength, 0); | 3075 expect(replacementLength, 0); |
3234 assertNotSuggested('B.bar'); | 3076 assertNotSuggested('B.bar'); |
3235 assertNotSuggested('Object'); | 3077 assertNotSuggested('Object'); |
3236 assertNotSuggested('X.c'); | 3078 assertNotSuggested('X.c'); |
3237 assertNotSuggested('X._d'); | 3079 assertNotSuggested('X._d'); |
3238 assertNotSuggested('A'); | 3080 assertNotSuggested('A'); |
3239 assertNotSuggested('F1'); | 3081 assertNotSuggested('F1'); |
3240 assertNotSuggested('T1'); | 3082 assertNotSuggested('T1'); |
3241 assertNotSuggested('_d'); | 3083 assertNotSuggested('_d'); |
3242 assertNotSuggested('z'); | 3084 assertNotSuggested('z'); |
3243 assertNotSuggested('m'); | 3085 assertNotSuggested('m'); |
3244 } | 3086 } |
3245 | 3087 |
3246 test_partFile_TypeName2() async { | 3088 test_partFile_TypeName2() async { |
3247 // SimpleIdentifier TypeName ConstructorName | 3089 // SimpleIdentifier TypeName ConstructorName |
3248 addSource( | 3090 addSource('/testB.dart', ''' |
3249 '/testB.dart', | |
3250 ''' | |
3251 lib B; | 3091 lib B; |
3252 int T1; | 3092 int T1; |
3253 F1() { } | 3093 F1() { } |
3254 class X {X.c(); X._d(); z() {}}'''); | 3094 class X {X.c(); X._d(); z() {}}'''); |
3255 addSource( | 3095 addSource('/testA.dart', ''' |
3256 '/testA.dart', | |
3257 ''' | |
3258 part of libA; | 3096 part of libA; |
3259 class B { }'''); | 3097 class B { }'''); |
3260 addTestSource(''' | 3098 addTestSource(''' |
3261 library libA; | 3099 library libA; |
3262 import "testB.dart"; | 3100 import "testB.dart"; |
3263 part "/testA.dart"; | 3101 part "/testA.dart"; |
3264 class A { A({String boo: 'hoo'}) { } } | 3102 class A { A({String boo: 'hoo'}) { } } |
3265 main() {new ^} | 3103 main() {new ^} |
3266 var m;'''); | 3104 var m;'''); |
3267 await computeSuggestions(); | 3105 await computeSuggestions(); |
3268 expect(replacementOffset, completionOffset); | 3106 expect(replacementOffset, completionOffset); |
3269 expect(replacementLength, 0); | 3107 expect(replacementLength, 0); |
3270 assertNotSuggested('A'); | 3108 assertNotSuggested('A'); |
3271 assertNotSuggested('Object'); | 3109 assertNotSuggested('Object'); |
3272 assertNotSuggested('X.c'); | 3110 assertNotSuggested('X.c'); |
3273 assertNotSuggested('X._d'); | 3111 assertNotSuggested('X._d'); |
3274 assertNotSuggested('B'); | 3112 assertNotSuggested('B'); |
3275 assertNotSuggested('F1'); | 3113 assertNotSuggested('F1'); |
3276 assertNotSuggested('T1'); | 3114 assertNotSuggested('T1'); |
3277 assertNotSuggested('_d'); | 3115 assertNotSuggested('_d'); |
3278 assertNotSuggested('z'); | 3116 assertNotSuggested('z'); |
3279 assertNotSuggested('m'); | 3117 assertNotSuggested('m'); |
3280 } | 3118 } |
3281 | 3119 |
3282 test_PrefixedIdentifier_class_const() async { | 3120 test_PrefixedIdentifier_class_const() async { |
3283 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block | 3121 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block |
3284 addSource( | 3122 addSource('/testB.dart', ''' |
3285 '/testB.dart', | |
3286 ''' | |
3287 lib B; | 3123 lib B; |
3288 class I { | 3124 class I { |
3289 static const scI = 'boo'; | 3125 static const scI = 'boo'; |
3290 X get f => new A(); | 3126 X get f => new A(); |
3291 get _g => new A();} | 3127 get _g => new A();} |
3292 class B implements I { | 3128 class B implements I { |
3293 static const int scB = 12; | 3129 static const int scB = 12; |
3294 var b; X _c; | 3130 var b; X _c; |
3295 X get d => new A();get _e => new A(); | 3131 X get d => new A();get _e => new A(); |
3296 set s1(I x) {} set _s2(I x) {} | 3132 set s1(I x) {} set _s2(I x) {} |
(...skipping 25 matching lines...) Expand all Loading... |
3322 assertNotSuggested('a'); | 3158 assertNotSuggested('a'); |
3323 assertNotSuggested('A'); | 3159 assertNotSuggested('A'); |
3324 assertNotSuggested('X'); | 3160 assertNotSuggested('X'); |
3325 assertNotSuggested('w'); | 3161 assertNotSuggested('w'); |
3326 assertNotSuggested('Object'); | 3162 assertNotSuggested('Object'); |
3327 assertNotSuggested('=='); | 3163 assertNotSuggested('=='); |
3328 } | 3164 } |
3329 | 3165 |
3330 test_PrefixedIdentifier_class_imported() async { | 3166 test_PrefixedIdentifier_class_imported() async { |
3331 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3167 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3332 addSource( | 3168 addSource('/testB.dart', ''' |
3333 '/testB.dart', | |
3334 ''' | |
3335 lib B; | 3169 lib B; |
3336 class I {X get f => new A();get _g => new A();} | 3170 class I {X get f => new A();get _g => new A();} |
3337 class A implements I { | 3171 class A implements I { |
3338 static const int sc = 12; | 3172 static const int sc = 12; |
3339 @deprecated var b; X _c; | 3173 @deprecated var b; X _c; |
3340 X get d => new A();get _e => new A(); | 3174 X get d => new A();get _e => new A(); |
3341 set s1(I x) {} set _s2(I x) {} | 3175 set s1(I x) {} set _s2(I x) {} |
3342 m(X x) {} I _n(X x) {}} | 3176 m(X x) {} I _n(X x) {}} |
3343 class X{}'''); | 3177 class X{}'''); |
3344 addTestSource(''' | 3178 addTestSource(''' |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3400 | 3234 |
3401 test_PrefixedIdentifier_getter() async { | 3235 test_PrefixedIdentifier_getter() async { |
3402 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3236 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3403 addTestSource('String get g => "one"; f() {g.^}'); | 3237 addTestSource('String get g => "one"; f() {g.^}'); |
3404 await computeSuggestions(); | 3238 await computeSuggestions(); |
3405 assertSuggestGetter('length', 'int'); | 3239 assertSuggestGetter('length', 'int'); |
3406 } | 3240 } |
3407 | 3241 |
3408 test_PrefixedIdentifier_library() async { | 3242 test_PrefixedIdentifier_library() async { |
3409 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3243 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3410 addSource( | 3244 addSource('/testB.dart', ''' |
3411 '/testB.dart', | |
3412 ''' | |
3413 lib B; | 3245 lib B; |
3414 var T1; | 3246 var T1; |
3415 class X { } | 3247 class X { } |
3416 class Y { }'''); | 3248 class Y { }'''); |
3417 addTestSource(''' | 3249 addTestSource(''' |
3418 import "testB.dart" as b; | 3250 import "testB.dart" as b; |
3419 var T2; | 3251 var T2; |
3420 class A { } | 3252 class A { } |
3421 main() {b.^}'''); | 3253 main() {b.^}'''); |
3422 await computeSuggestions(); | 3254 await computeSuggestions(); |
3423 expect(replacementOffset, completionOffset); | 3255 expect(replacementOffset, completionOffset); |
3424 expect(replacementLength, 0); | 3256 expect(replacementLength, 0); |
3425 // Suggested by LibraryMemberContributor | 3257 // Suggested by LibraryMemberContributor |
3426 assertNotSuggested('X'); | 3258 assertNotSuggested('X'); |
3427 assertNotSuggested('Y'); | 3259 assertNotSuggested('Y'); |
3428 assertNotSuggested('T1'); | 3260 assertNotSuggested('T1'); |
3429 assertNotSuggested('T2'); | 3261 assertNotSuggested('T2'); |
3430 assertNotSuggested('Object'); | 3262 assertNotSuggested('Object'); |
3431 assertNotSuggested('b'); | 3263 assertNotSuggested('b'); |
3432 assertNotSuggested('A'); | 3264 assertNotSuggested('A'); |
3433 assertNotSuggested('=='); | 3265 assertNotSuggested('=='); |
3434 } | 3266 } |
3435 | 3267 |
3436 test_PrefixedIdentifier_library_typesOnly() async { | 3268 test_PrefixedIdentifier_library_typesOnly() async { |
3437 // SimpleIdentifier PrefixedIdentifier TypeName | 3269 // SimpleIdentifier PrefixedIdentifier TypeName |
3438 addSource( | 3270 addSource('/testB.dart', ''' |
3439 '/testB.dart', | |
3440 ''' | |
3441 lib B; | 3271 lib B; |
3442 var T1; | 3272 var T1; |
3443 class X { } | 3273 class X { } |
3444 class Y { }'''); | 3274 class Y { }'''); |
3445 addTestSource(''' | 3275 addTestSource(''' |
3446 import "testB.dart" as b; | 3276 import "testB.dart" as b; |
3447 var T2; | 3277 var T2; |
3448 class A { } | 3278 class A { } |
3449 foo(b.^ f) {}'''); | 3279 foo(b.^ f) {}'''); |
3450 await computeSuggestions(); | 3280 await computeSuggestions(); |
3451 expect(replacementOffset, completionOffset); | 3281 expect(replacementOffset, completionOffset); |
3452 expect(replacementLength, 0); | 3282 expect(replacementLength, 0); |
3453 // Suggested by LibraryMemberContributor | 3283 // Suggested by LibraryMemberContributor |
3454 assertNotSuggested('X'); | 3284 assertNotSuggested('X'); |
3455 assertNotSuggested('Y'); | 3285 assertNotSuggested('Y'); |
3456 assertNotSuggested('T1'); | 3286 assertNotSuggested('T1'); |
3457 assertNotSuggested('T2'); | 3287 assertNotSuggested('T2'); |
3458 assertNotSuggested('Object'); | 3288 assertNotSuggested('Object'); |
3459 assertNotSuggested('b'); | 3289 assertNotSuggested('b'); |
3460 assertNotSuggested('A'); | 3290 assertNotSuggested('A'); |
3461 assertNotSuggested('=='); | 3291 assertNotSuggested('=='); |
3462 } | 3292 } |
3463 | 3293 |
3464 test_PrefixedIdentifier_library_typesOnly2() async { | 3294 test_PrefixedIdentifier_library_typesOnly2() async { |
3465 // SimpleIdentifier PrefixedIdentifier TypeName | 3295 // SimpleIdentifier PrefixedIdentifier TypeName |
3466 addSource( | 3296 addSource('/testB.dart', ''' |
3467 '/testB.dart', | |
3468 ''' | |
3469 lib B; | 3297 lib B; |
3470 var T1; | 3298 var T1; |
3471 class X { } | 3299 class X { } |
3472 class Y { }'''); | 3300 class Y { }'''); |
3473 addTestSource(''' | 3301 addTestSource(''' |
3474 import "testB.dart" as b; | 3302 import "testB.dart" as b; |
3475 var T2; | 3303 var T2; |
3476 class A { } | 3304 class A { } |
3477 foo(b.^) {}'''); | 3305 foo(b.^) {}'''); |
3478 await computeSuggestions(); | 3306 await computeSuggestions(); |
3479 expect(replacementOffset, completionOffset); | 3307 expect(replacementOffset, completionOffset); |
3480 expect(replacementLength, 0); | 3308 expect(replacementLength, 0); |
3481 // Suggested by LibraryMemberContributor | 3309 // Suggested by LibraryMemberContributor |
3482 assertNotSuggested('X'); | 3310 assertNotSuggested('X'); |
3483 assertNotSuggested('Y'); | 3311 assertNotSuggested('Y'); |
3484 assertNotSuggested('T1'); | 3312 assertNotSuggested('T1'); |
3485 assertNotSuggested('T2'); | 3313 assertNotSuggested('T2'); |
3486 assertNotSuggested('Object'); | 3314 assertNotSuggested('Object'); |
3487 assertNotSuggested('b'); | 3315 assertNotSuggested('b'); |
3488 assertNotSuggested('A'); | 3316 assertNotSuggested('A'); |
3489 assertNotSuggested('=='); | 3317 assertNotSuggested('=='); |
3490 } | 3318 } |
3491 | 3319 |
3492 test_PrefixedIdentifier_parameter() async { | 3320 test_PrefixedIdentifier_parameter() async { |
3493 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3321 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3494 addSource( | 3322 addSource('/testB.dart', ''' |
3495 '/testB.dart', | |
3496 ''' | |
3497 lib B; | 3323 lib B; |
3498 class _W {M y; var _z;} | 3324 class _W {M y; var _z;} |
3499 class X extends _W {} | 3325 class X extends _W {} |
3500 class M{}'''); | 3326 class M{}'''); |
3501 addTestSource(''' | 3327 addTestSource(''' |
3502 import "testB.dart"; | 3328 import "testB.dart"; |
3503 foo(X x) {x.^}'''); | 3329 foo(X x) {x.^}'''); |
3504 await computeSuggestions(); | 3330 await computeSuggestions(); |
3505 expect(replacementOffset, completionOffset); | 3331 expect(replacementOffset, completionOffset); |
3506 expect(replacementLength, 0); | 3332 expect(replacementLength, 0); |
3507 assertSuggestField('y', 'M'); | 3333 assertSuggestField('y', 'M'); |
3508 assertNotSuggested('_z'); | 3334 assertNotSuggested('_z'); |
3509 assertNotSuggested('=='); | 3335 assertNotSuggested('=='); |
3510 } | 3336 } |
3511 | 3337 |
3512 test_PrefixedIdentifier_prefix() async { | 3338 test_PrefixedIdentifier_prefix() async { |
3513 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3339 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3514 addSource( | 3340 addSource('/testA.dart', ''' |
3515 '/testA.dart', | |
3516 ''' | |
3517 class A {static int bar = 10;} | 3341 class A {static int bar = 10;} |
3518 _B() {}'''); | 3342 _B() {}'''); |
3519 addTestSource(''' | 3343 addTestSource(''' |
3520 import "testA.dart"; | 3344 import "testA.dart"; |
3521 class X {foo(){A^.bar}}'''); | 3345 class X {foo(){A^.bar}}'''); |
3522 await computeSuggestions(); | 3346 await computeSuggestions(); |
3523 expect(replacementOffset, completionOffset - 1); | 3347 expect(replacementOffset, completionOffset - 1); |
3524 expect(replacementLength, 1); | 3348 expect(replacementLength, 1); |
3525 assertNotSuggested('A'); | 3349 assertNotSuggested('A'); |
3526 assertNotSuggested('X'); | 3350 assertNotSuggested('X'); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4075 test_TopLevelVariableDeclaration_untyped_name() async { | 3899 test_TopLevelVariableDeclaration_untyped_name() async { |
4076 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3900 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4077 // TopLevelVariableDeclaration | 3901 // TopLevelVariableDeclaration |
4078 addTestSource('class A {} var ^'); | 3902 addTestSource('class A {} var ^'); |
4079 await computeSuggestions(); | 3903 await computeSuggestions(); |
4080 assertNoSuggestions(); | 3904 assertNoSuggestions(); |
4081 } | 3905 } |
4082 | 3906 |
4083 test_TypeArgumentList() async { | 3907 test_TypeArgumentList() async { |
4084 // SimpleIdentifier BinaryExpression ExpressionStatement | 3908 // SimpleIdentifier BinaryExpression ExpressionStatement |
4085 addSource( | 3909 addSource('/testA.dart', ''' |
4086 '/testA.dart', | |
4087 ''' | |
4088 class C1 {int x;} | 3910 class C1 {int x;} |
4089 F1() => 0; | 3911 F1() => 0; |
4090 typedef String T1(int blat);'''); | 3912 typedef String T1(int blat);'''); |
4091 addTestSource(''' | 3913 addTestSource(''' |
4092 import "testA.dart";' | 3914 import "testA.dart";' |
4093 class C2 {int x;} | 3915 class C2 {int x;} |
4094 F2() => 0; | 3916 F2() => 0; |
4095 typedef int T2(int blat); | 3917 typedef int T2(int blat); |
4096 class C<E> {} | 3918 class C<E> {} |
4097 main() { C<^> c; }'''); | 3919 main() { C<^> c; }'''); |
4098 await computeSuggestions(); | 3920 await computeSuggestions(); |
4099 expect(replacementOffset, completionOffset); | 3921 expect(replacementOffset, completionOffset); |
4100 expect(replacementLength, 0); | 3922 expect(replacementLength, 0); |
4101 assertNotSuggested('Object'); | 3923 assertNotSuggested('Object'); |
4102 assertNotSuggested('C1'); | 3924 assertNotSuggested('C1'); |
4103 assertNotSuggested('T1'); | 3925 assertNotSuggested('T1'); |
4104 assertNotSuggested('C2'); | 3926 assertNotSuggested('C2'); |
4105 assertNotSuggested('T2'); | 3927 assertNotSuggested('T2'); |
4106 assertNotSuggested('F1'); | 3928 assertNotSuggested('F1'); |
4107 assertNotSuggested('F2'); | 3929 assertNotSuggested('F2'); |
4108 } | 3930 } |
4109 | 3931 |
4110 test_TypeArgumentList2() async { | 3932 test_TypeArgumentList2() async { |
4111 // TypeName TypeArgumentList TypeName | 3933 // TypeName TypeArgumentList TypeName |
4112 addSource( | 3934 addSource('/testA.dart', ''' |
4113 '/testA.dart', | |
4114 ''' | |
4115 class C1 {int x;} | 3935 class C1 {int x;} |
4116 F1() => 0; | 3936 F1() => 0; |
4117 typedef String T1(int blat);'''); | 3937 typedef String T1(int blat);'''); |
4118 addTestSource(''' | 3938 addTestSource(''' |
4119 import "testA.dart";' | 3939 import "testA.dart";' |
4120 class C2 {int x;} | 3940 class C2 {int x;} |
4121 F2() => 0; | 3941 F2() => 0; |
4122 typedef int T2(int blat); | 3942 typedef int T2(int blat); |
4123 class C<E> {} | 3943 class C<E> {} |
4124 main() { C<C^> c; }'''); | 3944 main() { C<C^> c; }'''); |
4125 await computeSuggestions(); | 3945 await computeSuggestions(); |
4126 expect(replacementOffset, completionOffset - 1); | 3946 expect(replacementOffset, completionOffset - 1); |
4127 expect(replacementLength, 1); | 3947 expect(replacementLength, 1); |
4128 assertNotSuggested('C1'); | 3948 assertNotSuggested('C1'); |
4129 assertNotSuggested('C2'); | 3949 assertNotSuggested('C2'); |
4130 } | 3950 } |
4131 | 3951 |
4132 test_VariableDeclaration_name() async { | 3952 test_VariableDeclaration_name() async { |
4133 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3953 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4134 // VariableDeclarationStatement Block | 3954 // VariableDeclarationStatement Block |
4135 addSource( | 3955 addSource('/testB.dart', ''' |
4136 '/testB.dart', | |
4137 ''' | |
4138 lib B; | 3956 lib B; |
4139 foo() { } | 3957 foo() { } |
4140 class _B { } | 3958 class _B { } |
4141 class X {X.c(); X._d(); z() {}}'''); | 3959 class X {X.c(); X._d(); z() {}}'''); |
4142 addTestSource(''' | 3960 addTestSource(''' |
4143 import "testB.dart"; | 3961 import "testB.dart"; |
4144 class Y {Y.c(); Y._d(); z() {}} | 3962 class Y {Y.c(); Y._d(); z() {}} |
4145 main() {var ^}'''); | 3963 main() {var ^}'''); |
4146 await computeSuggestions(); | 3964 await computeSuggestions(); |
4147 assertNoSuggestions(); | 3965 assertNoSuggestions(); |
4148 } | 3966 } |
4149 | 3967 |
4150 test_VariableDeclarationList_final() async { | 3968 test_VariableDeclarationList_final() async { |
4151 // VariableDeclarationList VariableDeclarationStatement Block | 3969 // VariableDeclarationList VariableDeclarationStatement Block |
4152 addTestSource('main() {final ^} class C { }'); | 3970 addTestSource('main() {final ^} class C { }'); |
4153 await computeSuggestions(); | 3971 await computeSuggestions(); |
4154 assertNotSuggested('Object'); | 3972 assertNotSuggested('Object'); |
4155 assertNotSuggested('C'); | 3973 assertNotSuggested('C'); |
4156 assertNotSuggested('=='); | 3974 assertNotSuggested('=='); |
4157 } | 3975 } |
4158 | 3976 |
4159 test_VariableDeclarationStatement_RHS() async { | 3977 test_VariableDeclarationStatement_RHS() async { |
4160 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3978 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4161 // VariableDeclarationStatement | 3979 // VariableDeclarationStatement |
4162 addSource( | 3980 addSource('/testB.dart', ''' |
4163 '/testB.dart', | |
4164 ''' | |
4165 lib B; | 3981 lib B; |
4166 foo() { } | 3982 foo() { } |
4167 class _B { } | 3983 class _B { } |
4168 class X {X.c(); X._d(); z() {}}'''); | 3984 class X {X.c(); X._d(); z() {}}'''); |
4169 addTestSource(''' | 3985 addTestSource(''' |
4170 import "testB.dart"; | 3986 import "testB.dart"; |
4171 class Y {Y.c(); Y._d(); z() {}} | 3987 class Y {Y.c(); Y._d(); z() {}} |
4172 class C {bar(){var f; {var x;} var e = ^}}'''); | 3988 class C {bar(){var f; {var x;} var e = ^}}'''); |
4173 await computeSuggestions(); | 3989 await computeSuggestions(); |
4174 expect(replacementOffset, completionOffset); | 3990 expect(replacementOffset, completionOffset); |
4175 expect(replacementLength, 0); | 3991 expect(replacementLength, 0); |
4176 assertNotSuggested('X'); | 3992 assertNotSuggested('X'); |
4177 assertNotSuggested('_B'); | 3993 assertNotSuggested('_B'); |
4178 assertNotSuggested('Y'); | 3994 assertNotSuggested('Y'); |
4179 assertNotSuggested('C'); | 3995 assertNotSuggested('C'); |
4180 assertNotSuggested('f'); | 3996 assertNotSuggested('f'); |
4181 assertNotSuggested('x'); | 3997 assertNotSuggested('x'); |
4182 assertNotSuggested('e'); | 3998 assertNotSuggested('e'); |
4183 } | 3999 } |
4184 | 4000 |
4185 test_VariableDeclarationStatement_RHS_missing_semicolon() async { | 4001 test_VariableDeclarationStatement_RHS_missing_semicolon() async { |
4186 // VariableDeclaration VariableDeclarationList | 4002 // VariableDeclaration VariableDeclarationList |
4187 // VariableDeclarationStatement | 4003 // VariableDeclarationStatement |
4188 addSource( | 4004 addSource('/testB.dart', ''' |
4189 '/testB.dart', | |
4190 ''' | |
4191 lib B; | 4005 lib B; |
4192 foo1() { } | 4006 foo1() { } |
4193 void bar1() { } | 4007 void bar1() { } |
4194 class _B { } | 4008 class _B { } |
4195 class X {X.c(); X._d(); z() {}}'''); | 4009 class X {X.c(); X._d(); z() {}}'''); |
4196 addTestSource(''' | 4010 addTestSource(''' |
4197 import "testB.dart"; | 4011 import "testB.dart"; |
4198 foo2() { } | 4012 foo2() { } |
4199 void bar2() { } | 4013 void bar2() { } |
4200 class Y {Y.c(); Y._d(); z() {}} | 4014 class Y {Y.c(); Y._d(); z() {}} |
4201 class C {bar(){var f; {var x;} var e = ^ var g}}'''); | 4015 class C {bar(){var f; {var x;} var e = ^ var g}}'''); |
4202 await computeSuggestions(); | 4016 await computeSuggestions(); |
4203 expect(replacementOffset, completionOffset); | 4017 expect(replacementOffset, completionOffset); |
4204 expect(replacementLength, 0); | 4018 expect(replacementLength, 0); |
4205 assertNotSuggested('X'); | 4019 assertNotSuggested('X'); |
4206 assertNotSuggested('foo1'); | 4020 assertNotSuggested('foo1'); |
4207 assertNotSuggested('bar1'); | 4021 assertNotSuggested('bar1'); |
4208 assertNotSuggested('foo2'); | 4022 assertNotSuggested('foo2'); |
4209 assertNotSuggested('bar2'); | 4023 assertNotSuggested('bar2'); |
4210 assertNotSuggested('_B'); | 4024 assertNotSuggested('_B'); |
4211 assertNotSuggested('Y'); | 4025 assertNotSuggested('Y'); |
4212 assertNotSuggested('C'); | 4026 assertNotSuggested('C'); |
4213 assertNotSuggested('f'); | 4027 assertNotSuggested('f'); |
4214 assertNotSuggested('x'); | 4028 assertNotSuggested('x'); |
4215 assertNotSuggested('e'); | 4029 assertNotSuggested('e'); |
4216 } | 4030 } |
4217 } | 4031 } |
OLD | NEW |