OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 'package:analysis_server/src/protocol_server.dart'; | 5 import 'package:analysis_server/src/protocol_server.dart'; |
6 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 6 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
7 import 'package:analysis_server/src/services/completion/dart/local_reference_con
tributor.dart'; | 7 import 'package:analysis_server/src/services/completion/dart/local_reference_con
tributor.dart'; |
8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 await computeSuggestions(); | 123 await computeSuggestions(); |
124 | 124 |
125 assertSuggestMethod('foo', 'A', 'bool', | 125 assertSuggestMethod('foo', 'A', 'bool', |
126 relevance: DART_RELEVANCE_LOCAL_METHOD, | 126 relevance: DART_RELEVANCE_LOCAL_METHOD, |
127 defaultArgListString: 'bar, baz: null', | 127 defaultArgListString: 'bar, baz: null', |
128 defaultArgumentListTextRanges: [0, 3, 10, 4]); | 128 defaultArgumentListTextRanges: [0, 3, 10, 4]); |
129 } | 129 } |
130 | 130 |
131 test_ArgumentList() async { | 131 test_ArgumentList() async { |
132 // ArgumentList MethodInvocation ExpressionStatement Block | 132 // ArgumentList MethodInvocation ExpressionStatement Block |
133 addSource( | 133 addSource('/libA.dart', ''' |
134 '/libA.dart', | |
135 ''' | |
136 library A; | 134 library A; |
137 bool hasLength(int expected) { } | 135 bool hasLength(int expected) { } |
138 void baz() { }'''); | 136 void baz() { }'''); |
139 addTestSource(''' | 137 addTestSource(''' |
140 import '/libA.dart'; | 138 import '/libA.dart'; |
141 class B { } | 139 class B { } |
142 String bar() => true; | 140 String bar() => true; |
143 void main() {expect(^)}'''); | 141 void main() {expect(^)}'''); |
144 await computeSuggestions(); | 142 await computeSuggestions(); |
145 | 143 |
146 expect(replacementOffset, completionOffset); | 144 expect(replacementOffset, completionOffset); |
147 expect(replacementLength, 0); | 145 expect(replacementLength, 0); |
148 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 146 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
149 assertSuggestFunction('bar', 'String', | 147 assertSuggestFunction('bar', 'String', |
150 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 148 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
151 assertNotSuggested('hasLength'); | 149 assertNotSuggested('hasLength'); |
152 assertNotSuggested('identical'); | 150 assertNotSuggested('identical'); |
153 assertSuggestClass('B'); | 151 assertSuggestClass('B'); |
154 assertNotSuggested('Object'); | 152 assertNotSuggested('Object'); |
155 assertNotSuggested('main'); | 153 assertNotSuggested('main'); |
156 assertNotSuggested('baz'); | 154 assertNotSuggested('baz'); |
157 assertNotSuggested('print'); | 155 assertNotSuggested('print'); |
158 } | 156 } |
159 | 157 |
160 test_ArgumentList_imported_function() async { | 158 test_ArgumentList_imported_function() async { |
161 // ArgumentList MethodInvocation ExpressionStatement Block | 159 // ArgumentList MethodInvocation ExpressionStatement Block |
162 addSource( | 160 addSource('/libA.dart', ''' |
163 '/libA.dart', | |
164 ''' | |
165 library A; | 161 library A; |
166 bool hasLength(int expected) { } | 162 bool hasLength(int expected) { } |
167 expect(arg) { } | 163 expect(arg) { } |
168 void baz() { }'''); | 164 void baz() { }'''); |
169 addTestSource(''' | 165 addTestSource(''' |
170 import '/libA.dart' | 166 import '/libA.dart' |
171 class B { } | 167 class B { } |
172 String bar() => true; | 168 String bar() => true; |
173 void main() {expect(^)}'''); | 169 void main() {expect(^)}'''); |
174 await computeSuggestions(); | 170 await computeSuggestions(); |
175 | 171 |
176 expect(replacementOffset, completionOffset); | 172 expect(replacementOffset, completionOffset); |
177 expect(replacementLength, 0); | 173 expect(replacementLength, 0); |
178 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 174 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
179 assertSuggestFunction('bar', 'String', | 175 assertSuggestFunction('bar', 'String', |
180 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 176 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
181 assertNotSuggested('hasLength'); | 177 assertNotSuggested('hasLength'); |
182 assertNotSuggested('identical'); | 178 assertNotSuggested('identical'); |
183 assertSuggestClass('B'); | 179 assertSuggestClass('B'); |
184 assertNotSuggested('Object'); | 180 assertNotSuggested('Object'); |
185 assertNotSuggested('main'); | 181 assertNotSuggested('main'); |
186 assertNotSuggested('baz'); | 182 assertNotSuggested('baz'); |
187 assertNotSuggested('print'); | 183 assertNotSuggested('print'); |
188 } | 184 } |
189 | 185 |
190 test_ArgumentList_InstanceCreationExpression_functionalArg() async { | 186 test_ArgumentList_InstanceCreationExpression_functionalArg() async { |
191 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 187 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
192 addSource( | 188 addSource('/libA.dart', ''' |
193 '/libA.dart', | |
194 ''' | |
195 library A; | 189 library A; |
196 class A { A(f()) { } } | 190 class A { A(f()) { } } |
197 bool hasLength(int expected) { } | 191 bool hasLength(int expected) { } |
198 void baz() { }'''); | 192 void baz() { }'''); |
199 addTestSource(''' | 193 addTestSource(''' |
200 import 'dart:async'; | 194 import 'dart:async'; |
201 import '/libA.dart'; | 195 import '/libA.dart'; |
202 class B { } | 196 class B { } |
203 String bar() => true; | 197 String bar() => true; |
204 void main() {new A(^)}'''); | 198 void main() {new A(^)}'''); |
(...skipping 10 matching lines...) Expand all Loading... |
215 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 209 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
216 assertNotSuggested('A'); | 210 assertNotSuggested('A'); |
217 assertNotSuggested('Object'); | 211 assertNotSuggested('Object'); |
218 assertNotSuggested('main'); | 212 assertNotSuggested('main'); |
219 assertNotSuggested('baz'); | 213 assertNotSuggested('baz'); |
220 assertNotSuggested('print'); | 214 assertNotSuggested('print'); |
221 } | 215 } |
222 | 216 |
223 test_ArgumentList_InstanceCreationExpression_typedefArg() async { | 217 test_ArgumentList_InstanceCreationExpression_typedefArg() async { |
224 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 218 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
225 addSource( | 219 addSource('/libA.dart', ''' |
226 '/libA.dart', | |
227 ''' | |
228 library A; | 220 library A; |
229 typedef Funct(); | 221 typedef Funct(); |
230 class A { A(Funct f) { } } | 222 class A { A(Funct f) { } } |
231 bool hasLength(int expected) { } | 223 bool hasLength(int expected) { } |
232 void baz() { }'''); | 224 void baz() { }'''); |
233 addTestSource(''' | 225 addTestSource(''' |
234 import 'dart:async'; | 226 import 'dart:async'; |
235 import '/libA.dart'; | 227 import '/libA.dart'; |
236 class B { } | 228 class B { } |
237 String bar() => true; | 229 String bar() => true; |
(...skipping 11 matching lines...) Expand all Loading... |
249 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 241 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
250 assertNotSuggested('A'); | 242 assertNotSuggested('A'); |
251 assertNotSuggested('Object'); | 243 assertNotSuggested('Object'); |
252 assertNotSuggested('main'); | 244 assertNotSuggested('main'); |
253 assertNotSuggested('baz'); | 245 assertNotSuggested('baz'); |
254 assertNotSuggested('print'); | 246 assertNotSuggested('print'); |
255 } | 247 } |
256 | 248 |
257 test_ArgumentList_local_function() async { | 249 test_ArgumentList_local_function() async { |
258 // ArgumentList MethodInvocation ExpressionStatement Block | 250 // ArgumentList MethodInvocation ExpressionStatement Block |
259 addSource( | 251 addSource('/libA.dart', ''' |
260 '/libA.dart', | |
261 ''' | |
262 library A; | 252 library A; |
263 bool hasLength(int expected) { } | 253 bool hasLength(int expected) { } |
264 void baz() { }'''); | 254 void baz() { }'''); |
265 addTestSource(''' | 255 addTestSource(''' |
266 import '/libA.dart' | 256 import '/libA.dart' |
267 expect(arg) { } | 257 expect(arg) { } |
268 class B { } | 258 class B { } |
269 String bar() => true; | 259 String bar() => true; |
270 void main() {expect(^)}'''); | 260 void main() {expect(^)}'''); |
271 await computeSuggestions(); | 261 await computeSuggestions(); |
272 | 262 |
273 expect(replacementOffset, completionOffset); | 263 expect(replacementOffset, completionOffset); |
274 expect(replacementLength, 0); | 264 expect(replacementLength, 0); |
275 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 265 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
276 assertSuggestFunction('bar', 'String', | 266 assertSuggestFunction('bar', 'String', |
277 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 267 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
278 assertNotSuggested('hasLength'); | 268 assertNotSuggested('hasLength'); |
279 assertNotSuggested('identical'); | 269 assertNotSuggested('identical'); |
280 assertSuggestClass('B'); | 270 assertSuggestClass('B'); |
281 assertNotSuggested('Object'); | 271 assertNotSuggested('Object'); |
282 assertNotSuggested('main'); | 272 assertNotSuggested('main'); |
283 assertNotSuggested('baz'); | 273 assertNotSuggested('baz'); |
284 assertNotSuggested('print'); | 274 assertNotSuggested('print'); |
285 } | 275 } |
286 | 276 |
287 test_ArgumentList_local_method() async { | 277 test_ArgumentList_local_method() async { |
288 // ArgumentList MethodInvocation ExpressionStatement Block | 278 // ArgumentList MethodInvocation ExpressionStatement Block |
289 addSource( | 279 addSource('/libA.dart', ''' |
290 '/libA.dart', | |
291 ''' | |
292 library A; | 280 library A; |
293 bool hasLength(int expected) { } | 281 bool hasLength(int expected) { } |
294 void baz() { }'''); | 282 void baz() { }'''); |
295 addTestSource(''' | 283 addTestSource(''' |
296 import '/libA.dart' | 284 import '/libA.dart' |
297 class B { | 285 class B { |
298 expect(arg) { } | 286 expect(arg) { } |
299 void foo() {expect(^)}} | 287 void foo() {expect(^)}} |
300 String bar() => true;'''); | 288 String bar() => true;'''); |
301 await computeSuggestions(); | 289 await computeSuggestions(); |
302 | 290 |
303 expect(replacementOffset, completionOffset); | 291 expect(replacementOffset, completionOffset); |
304 expect(replacementLength, 0); | 292 expect(replacementLength, 0); |
305 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 293 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
306 assertSuggestFunction('bar', 'String', | 294 assertSuggestFunction('bar', 'String', |
307 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 295 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
308 assertNotSuggested('hasLength'); | 296 assertNotSuggested('hasLength'); |
309 assertNotSuggested('identical'); | 297 assertNotSuggested('identical'); |
310 assertSuggestClass('B'); | 298 assertSuggestClass('B'); |
311 assertNotSuggested('Object'); | 299 assertNotSuggested('Object'); |
312 assertNotSuggested('main'); | 300 assertNotSuggested('main'); |
313 assertNotSuggested('baz'); | 301 assertNotSuggested('baz'); |
314 assertNotSuggested('print'); | 302 assertNotSuggested('print'); |
315 } | 303 } |
316 | 304 |
317 test_ArgumentList_MethodInvocation_functionalArg() async { | 305 test_ArgumentList_MethodInvocation_functionalArg() async { |
318 // ArgumentList MethodInvocation ExpressionStatement Block | 306 // ArgumentList MethodInvocation ExpressionStatement Block |
319 addSource( | 307 addSource('/libA.dart', ''' |
320 '/libA.dart', | |
321 ''' | |
322 library A; | 308 library A; |
323 class A { A(f()) { } } | 309 class A { A(f()) { } } |
324 bool hasLength(int expected) { } | 310 bool hasLength(int expected) { } |
325 void baz() { }'''); | 311 void baz() { }'''); |
326 addTestSource(''' | 312 addTestSource(''' |
327 import 'dart:async'; | 313 import 'dart:async'; |
328 import '/libA.dart'; | 314 import '/libA.dart'; |
329 class B { } | 315 class B { } |
330 String bar(f()) => true; | 316 String bar(f()) => true; |
331 void main() {boo(){} bar(^);}'''); | 317 void main() {boo(){} bar(^);}'''); |
(...skipping 13 matching lines...) Expand all Loading... |
345 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 331 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
346 assertNotSuggested('A'); | 332 assertNotSuggested('A'); |
347 assertNotSuggested('Object'); | 333 assertNotSuggested('Object'); |
348 assertNotSuggested('main'); | 334 assertNotSuggested('main'); |
349 assertNotSuggested('baz'); | 335 assertNotSuggested('baz'); |
350 assertNotSuggested('print'); | 336 assertNotSuggested('print'); |
351 } | 337 } |
352 | 338 |
353 test_ArgumentList_MethodInvocation_functionalArg2() async { | 339 test_ArgumentList_MethodInvocation_functionalArg2() async { |
354 // ArgumentList MethodInvocation ExpressionStatement Block | 340 // ArgumentList MethodInvocation ExpressionStatement Block |
355 addSource( | 341 addSource('/libA.dart', ''' |
356 '/libA.dart', | |
357 ''' | |
358 library A; | 342 library A; |
359 class A { A(f()) { } } | 343 class A { A(f()) { } } |
360 bool hasLength(int expected) { } | 344 bool hasLength(int expected) { } |
361 void baz() { }'''); | 345 void baz() { }'''); |
362 addTestSource(''' | 346 addTestSource(''' |
363 import 'dart:async'; | 347 import 'dart:async'; |
364 import '/libA.dart'; | 348 import '/libA.dart'; |
365 class B { } | 349 class B { } |
366 String bar({inc()}) => true; | 350 String bar({inc()}) => true; |
367 void main() {boo(){} bar(inc: ^);}'''); | 351 void main() {boo(){} bar(inc: ^);}'''); |
(...skipping 13 matching lines...) Expand all Loading... |
381 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 365 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
382 assertNotSuggested('A'); | 366 assertNotSuggested('A'); |
383 assertNotSuggested('Object'); | 367 assertNotSuggested('Object'); |
384 assertNotSuggested('main'); | 368 assertNotSuggested('main'); |
385 assertNotSuggested('baz'); | 369 assertNotSuggested('baz'); |
386 assertNotSuggested('print'); | 370 assertNotSuggested('print'); |
387 } | 371 } |
388 | 372 |
389 test_ArgumentList_MethodInvocation_methodArg() async { | 373 test_ArgumentList_MethodInvocation_methodArg() async { |
390 // ArgumentList MethodInvocation ExpressionStatement Block | 374 // ArgumentList MethodInvocation ExpressionStatement Block |
391 addSource( | 375 addSource('/libA.dart', ''' |
392 '/libA.dart', | |
393 ''' | |
394 library A; | 376 library A; |
395 class A { A(f()) { } } | 377 class A { A(f()) { } } |
396 bool hasLength(int expected) { } | 378 bool hasLength(int expected) { } |
397 void baz() { }'''); | 379 void baz() { }'''); |
398 addTestSource(''' | 380 addTestSource(''' |
399 import 'dart:async'; | 381 import 'dart:async'; |
400 import '/libA.dart'; | 382 import '/libA.dart'; |
401 class B { String bar(f()) => true; } | 383 class B { String bar(f()) => true; } |
402 void main() {new B().bar(^);}'''); | 384 void main() {new B().bar(^);}'''); |
403 await computeSuggestions(); | 385 await computeSuggestions(); |
404 | 386 |
405 expect(replacementOffset, completionOffset); | 387 expect(replacementOffset, completionOffset); |
406 expect(replacementLength, 0); | 388 expect(replacementLength, 0); |
407 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 389 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
408 assertNotSuggested('hasLength'); | 390 assertNotSuggested('hasLength'); |
409 assertNotSuggested('identical'); | 391 assertNotSuggested('identical'); |
410 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 392 assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
411 assertNotSuggested('A'); | 393 assertNotSuggested('A'); |
412 assertNotSuggested('Object'); | 394 assertNotSuggested('Object'); |
413 assertNotSuggested('main'); | 395 assertNotSuggested('main'); |
414 assertNotSuggested('baz'); | 396 assertNotSuggested('baz'); |
415 assertNotSuggested('print'); | 397 assertNotSuggested('print'); |
416 } | 398 } |
417 | 399 |
418 test_ArgumentList_namedFieldParam_tear_off() async { | 400 test_ArgumentList_namedFieldParam_tear_off() async { |
419 addSource( | 401 addSource('/libA.dart', ''' |
420 '/libA.dart', | |
421 ''' | |
422 typedef void VoidCallback(); | 402 typedef void VoidCallback(); |
423 | 403 |
424 class Button { | 404 class Button { |
425 final VoidCallback onPressed; | 405 final VoidCallback onPressed; |
426 Button({this.onPressed}); | 406 Button({this.onPressed}); |
427 } | 407 } |
428 '''); | 408 '''); |
429 addTestSource(''' | 409 addTestSource(''' |
430 import '/libA.dart'; | 410 import '/libA.dart'; |
431 | 411 |
(...skipping 10 matching lines...) Expand all Loading... |
442 expect(replacementOffset, completionOffset); | 422 expect(replacementOffset, completionOffset); |
443 expect(replacementLength, 0); | 423 expect(replacementLength, 0); |
444 | 424 |
445 assertSuggest('_incrementCounter', | 425 assertSuggest('_incrementCounter', |
446 csKind: CompletionSuggestionKind.IDENTIFIER); | 426 csKind: CompletionSuggestionKind.IDENTIFIER); |
447 } | 427 } |
448 | 428 |
449 test_ArgumentList_namedParam() async { | 429 test_ArgumentList_namedParam() async { |
450 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation | 430 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation |
451 // ExpressionStatement | 431 // ExpressionStatement |
452 addSource( | 432 addSource('/libA.dart', ''' |
453 '/libA.dart', | |
454 ''' | |
455 library A; | 433 library A; |
456 bool hasLength(int expected) { }'''); | 434 bool hasLength(int expected) { }'''); |
457 addTestSource(''' | 435 addTestSource(''' |
458 import '/libA.dart' | 436 import '/libA.dart' |
459 String bar() => true; | 437 String bar() => true; |
460 void main() {expect(foo: ^)}'''); | 438 void main() {expect(foo: ^)}'''); |
461 await computeSuggestions(); | 439 await computeSuggestions(); |
462 | 440 |
463 expect(replacementOffset, completionOffset); | 441 expect(replacementOffset, completionOffset); |
464 expect(replacementLength, 0); | 442 expect(replacementLength, 0); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 assertSuggestTopLevelVar('c', 'C', | 477 assertSuggestTopLevelVar('c', 'C', |
500 relevance: | 478 relevance: |
501 DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT); | 479 DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT); |
502 assertSuggestTopLevelVar('d', 'D', | 480 assertSuggestTopLevelVar('d', 'D', |
503 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 481 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
504 assertSuggestTopLevelVar('e', 'E', | 482 assertSuggestTopLevelVar('e', 'E', |
505 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 483 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
506 } | 484 } |
507 | 485 |
508 test_ArgumentList_namedParam_tear_off() async { | 486 test_ArgumentList_namedParam_tear_off() async { |
509 addSource( | 487 addSource('/libA.dart', ''' |
510 '/libA.dart', | |
511 ''' | |
512 typedef void VoidCallback(); | 488 typedef void VoidCallback(); |
513 | 489 |
514 class Button { | 490 class Button { |
515 Button({VoidCallback onPressed}); | 491 Button({VoidCallback onPressed}); |
516 } | 492 } |
517 '''); | 493 '''); |
518 addTestSource(''' | 494 addTestSource(''' |
519 import '/libA.dart'; | 495 import '/libA.dart'; |
520 | 496 |
521 class PageState { | 497 class PageState { |
522 void _incrementCounter() { } | 498 void _incrementCounter() { } |
523 build() => | 499 build() => |
524 new Button( | 500 new Button( |
525 onPressed: ^ | 501 onPressed: ^ |
526 ); | 502 ); |
527 } | 503 } |
528 '''); | 504 '''); |
529 await computeSuggestions(); | 505 await computeSuggestions(); |
530 | 506 |
531 expect(replacementOffset, completionOffset); | 507 expect(replacementOffset, completionOffset); |
532 expect(replacementLength, 0); | 508 expect(replacementLength, 0); |
533 | 509 |
534 assertSuggest('_incrementCounter', | 510 assertSuggest('_incrementCounter', |
535 csKind: CompletionSuggestionKind.IDENTIFIER); | 511 csKind: CompletionSuggestionKind.IDENTIFIER); |
536 } | 512 } |
537 | 513 |
538 test_ArgumentList_namedParam_tear_off_1() async { | 514 test_ArgumentList_namedParam_tear_off_1() async { |
539 addSource( | 515 addSource('/libA.dart', ''' |
540 '/libA.dart', | |
541 ''' | |
542 typedef void VoidCallback(); | 516 typedef void VoidCallback(); |
543 | 517 |
544 class Button { | 518 class Button { |
545 Button({VoidCallback onPressed, int x}); | 519 Button({VoidCallback onPressed, int x}); |
546 } | 520 } |
547 '''); | 521 '''); |
548 addTestSource(''' | 522 addTestSource(''' |
549 import '/libA.dart'; | 523 import '/libA.dart'; |
550 | 524 |
551 class PageState { | 525 class PageState { |
552 void _incrementCounter() { } | 526 void _incrementCounter() { } |
553 build() => | 527 build() => |
554 new Button( | 528 new Button( |
555 onPressed: ^ | 529 onPressed: ^ |
556 ); | 530 ); |
557 } | 531 } |
558 '''); | 532 '''); |
559 await computeSuggestions(); | 533 await computeSuggestions(); |
560 | 534 |
561 expect(replacementOffset, completionOffset); | 535 expect(replacementOffset, completionOffset); |
562 expect(replacementLength, 0); | 536 expect(replacementLength, 0); |
563 | 537 |
564 assertSuggest('_incrementCounter', | 538 assertSuggest('_incrementCounter', |
565 csKind: CompletionSuggestionKind.IDENTIFIER); | 539 csKind: CompletionSuggestionKind.IDENTIFIER); |
566 } | 540 } |
567 | 541 |
568 test_ArgumentList_namedParam_tear_off_2() async { | 542 test_ArgumentList_namedParam_tear_off_2() async { |
569 addSource( | 543 addSource('/libA.dart', ''' |
570 '/libA.dart', | |
571 ''' | |
572 typedef void VoidCallback(); | 544 typedef void VoidCallback(); |
573 | 545 |
574 class Button { | 546 class Button { |
575 Button({ int x, VoidCallback onPressed); | 547 Button({ int x, VoidCallback onPressed); |
576 } | 548 } |
577 '''); | 549 '''); |
578 addTestSource(''' | 550 addTestSource(''' |
579 import '/libA.dart'; | 551 import '/libA.dart'; |
580 | 552 |
581 class PageState { | 553 class PageState { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 expect(replacementOffset, completionOffset); | 802 expect(replacementOffset, completionOffset); |
831 expect(replacementLength, 0); | 803 expect(replacementLength, 0); |
832 assertSuggestLocalVariable('a', 'int'); | 804 assertSuggestLocalVariable('a', 'int'); |
833 assertNotSuggested('Object'); | 805 assertNotSuggested('Object'); |
834 assertNotSuggested('b'); | 806 assertNotSuggested('b'); |
835 assertNotSuggested('=='); | 807 assertNotSuggested('=='); |
836 } | 808 } |
837 | 809 |
838 test_Block() async { | 810 test_Block() async { |
839 // Block BlockFunctionBody MethodDeclaration | 811 // Block BlockFunctionBody MethodDeclaration |
840 addSource( | 812 addSource('/testAB.dart', ''' |
841 '/testAB.dart', | |
842 ''' | |
843 export "dart:math" hide max; | 813 export "dart:math" hide max; |
844 class A {int x;} | 814 class A {int x;} |
845 @deprecated D1() {int x;} | 815 @deprecated D1() {int x;} |
846 class _B {boo() { partBoo() {}} }'''); | 816 class _B {boo() { partBoo() {}} }'''); |
847 addSource( | 817 addSource('/testCD.dart', ''' |
848 '/testCD.dart', | |
849 ''' | |
850 String T1; | 818 String T1; |
851 var _T2; | 819 var _T2; |
852 class C { } | 820 class C { } |
853 class D { }'''); | 821 class D { }'''); |
854 addSource( | 822 addSource('/testEEF.dart', ''' |
855 '/testEEF.dart', | |
856 ''' | |
857 class EE { } | 823 class EE { } |
858 class F { }'''); | 824 class F { }'''); |
859 addSource('/testG.dart', 'class G { }'); | 825 addSource('/testG.dart', 'class G { }'); |
860 addSource( | 826 addSource('/testH.dart', ''' |
861 '/testH.dart', | |
862 ''' | |
863 class H { } | 827 class H { } |
864 int T3; | 828 int T3; |
865 var _T4;'''); // not imported | 829 var _T4;'''); // not imported |
866 addTestSource(''' | 830 addTestSource(''' |
867 import "/testAB.dart"; | 831 import "/testAB.dart"; |
868 import "/testCD.dart" hide D; | 832 import "/testCD.dart" hide D; |
869 import "/testEEF.dart" show EE; | 833 import "/testEEF.dart" show EE; |
870 import "/testG.dart" as g; | 834 import "/testG.dart" as g; |
871 int T5; | 835 int T5; |
872 var _T6; | 836 var _T6; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 assertSuggestSetter('blog', relevance: DART_RELEVANCE_LOCAL_ACCESSOR); | 900 assertSuggestSetter('blog', relevance: DART_RELEVANCE_LOCAL_ACCESSOR); |
937 // TODO (danrubel) suggest HtmlElement as low relevance | 901 // TODO (danrubel) suggest HtmlElement as low relevance |
938 assertNotSuggested('HtmlElement'); | 902 assertNotSuggested('HtmlElement'); |
939 assertNotSuggested('Uri'); | 903 assertNotSuggested('Uri'); |
940 assertNotSuggested('parseIPv6Address'); | 904 assertNotSuggested('parseIPv6Address'); |
941 assertNotSuggested('parseHex'); | 905 assertNotSuggested('parseHex'); |
942 } | 906 } |
943 | 907 |
944 test_Block_final() async { | 908 test_Block_final() async { |
945 // Block BlockFunctionBody MethodDeclaration | 909 // Block BlockFunctionBody MethodDeclaration |
946 addSource( | 910 addSource('/testAB.dart', ''' |
947 '/testAB.dart', | |
948 ''' | |
949 export "dart:math" hide max; | 911 export "dart:math" hide max; |
950 class A {int x;} | 912 class A {int x;} |
951 @deprecated D1() {int x;} | 913 @deprecated D1() {int x;} |
952 class _B {boo() { partBoo() {}} }'''); | 914 class _B {boo() { partBoo() {}} }'''); |
953 addSource( | 915 addSource('/testCD.dart', ''' |
954 '/testCD.dart', | |
955 ''' | |
956 String T1; | 916 String T1; |
957 var _T2; | 917 var _T2; |
958 class C { } | 918 class C { } |
959 class D { }'''); | 919 class D { }'''); |
960 addSource( | 920 addSource('/testEEF.dart', ''' |
961 '/testEEF.dart', | |
962 ''' | |
963 class EE { } | 921 class EE { } |
964 class F { }'''); | 922 class F { }'''); |
965 addSource('/testG.dart', 'class G { }'); | 923 addSource('/testG.dart', 'class G { }'); |
966 addSource( | 924 addSource('/testH.dart', ''' |
967 '/testH.dart', | |
968 ''' | |
969 class H { } | 925 class H { } |
970 int T3; | 926 int T3; |
971 var _T4;'''); // not imported | 927 var _T4;'''); // not imported |
972 addTestSource(''' | 928 addTestSource(''' |
973 import "/testAB.dart"; | 929 import "/testAB.dart"; |
974 import "/testCD.dart" hide D; | 930 import "/testCD.dart" hide D; |
975 import "/testEEF.dart" show EE; | 931 import "/testEEF.dart" show EE; |
976 import "/testG.dart" as g; | 932 import "/testG.dart" as g; |
977 int T5; | 933 int T5; |
978 var _T6; | 934 var _T6; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 | 1013 |
1058 test_Block_final3() async { | 1014 test_Block_final3() async { |
1059 addTestSource('main() {final ^ v;}'); | 1015 addTestSource('main() {final ^ v;}'); |
1060 await computeSuggestions(); | 1016 await computeSuggestions(); |
1061 | 1017 |
1062 assertNotSuggested('String'); | 1018 assertNotSuggested('String'); |
1063 } | 1019 } |
1064 | 1020 |
1065 test_Block_final_final() async { | 1021 test_Block_final_final() async { |
1066 // Block BlockFunctionBody MethodDeclaration | 1022 // Block BlockFunctionBody MethodDeclaration |
1067 addSource( | 1023 addSource('/testAB.dart', ''' |
1068 '/testAB.dart', | |
1069 ''' | |
1070 export "dart:math" hide max; | 1024 export "dart:math" hide max; |
1071 class A {int x;} | 1025 class A {int x;} |
1072 @deprecated D1() {int x;} | 1026 @deprecated D1() {int x;} |
1073 class _B {boo() { partBoo() {}} }'''); | 1027 class _B {boo() { partBoo() {}} }'''); |
1074 addSource( | 1028 addSource('/testCD.dart', ''' |
1075 '/testCD.dart', | |
1076 ''' | |
1077 String T1; | 1029 String T1; |
1078 var _T2; | 1030 var _T2; |
1079 class C { } | 1031 class C { } |
1080 class D { }'''); | 1032 class D { }'''); |
1081 addSource( | 1033 addSource('/testEEF.dart', ''' |
1082 '/testEEF.dart', | |
1083 ''' | |
1084 class EE { } | 1034 class EE { } |
1085 class F { }'''); | 1035 class F { }'''); |
1086 addSource('/testG.dart', 'class G { }'); | 1036 addSource('/testG.dart', 'class G { }'); |
1087 addSource( | 1037 addSource('/testH.dart', ''' |
1088 '/testH.dart', | |
1089 ''' | |
1090 class H { } | 1038 class H { } |
1091 int T3; | 1039 int T3; |
1092 var _T4;'''); // not imported | 1040 var _T4;'''); // not imported |
1093 addTestSource(''' | 1041 addTestSource(''' |
1094 import "/testAB.dart"; | 1042 import "/testAB.dart"; |
1095 import "/testCD.dart" hide D; | 1043 import "/testCD.dart" hide D; |
1096 import "/testEEF.dart" show EE; | 1044 import "/testEEF.dart" show EE; |
1097 import "/testG.dart" as g; | 1045 import "/testG.dart" as g; |
1098 int T5; | 1046 int T5; |
1099 var _T6; | 1047 var _T6; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 assertNotSuggested('blog'); | 1112 assertNotSuggested('blog'); |
1165 // TODO (danrubel) suggest HtmlElement as low relevance | 1113 // TODO (danrubel) suggest HtmlElement as low relevance |
1166 assertNotSuggested('HtmlElement'); | 1114 assertNotSuggested('HtmlElement'); |
1167 assertNotSuggested('Uri'); | 1115 assertNotSuggested('Uri'); |
1168 assertNotSuggested('parseIPv6Address'); | 1116 assertNotSuggested('parseIPv6Address'); |
1169 assertNotSuggested('parseHex'); | 1117 assertNotSuggested('parseHex'); |
1170 } | 1118 } |
1171 | 1119 |
1172 test_Block_final_var() async { | 1120 test_Block_final_var() async { |
1173 // Block BlockFunctionBody MethodDeclaration | 1121 // Block BlockFunctionBody MethodDeclaration |
1174 addSource( | 1122 addSource('/testAB.dart', ''' |
1175 '/testAB.dart', | |
1176 ''' | |
1177 export "dart:math" hide max; | 1123 export "dart:math" hide max; |
1178 class A {int x;} | 1124 class A {int x;} |
1179 @deprecated D1() {int x;} | 1125 @deprecated D1() {int x;} |
1180 class _B {boo() { partBoo() {}} }'''); | 1126 class _B {boo() { partBoo() {}} }'''); |
1181 addSource( | 1127 addSource('/testCD.dart', ''' |
1182 '/testCD.dart', | |
1183 ''' | |
1184 String T1; | 1128 String T1; |
1185 var _T2; | 1129 var _T2; |
1186 class C { } | 1130 class C { } |
1187 class D { }'''); | 1131 class D { }'''); |
1188 addSource( | 1132 addSource('/testEEF.dart', ''' |
1189 '/testEEF.dart', | |
1190 ''' | |
1191 class EE { } | 1133 class EE { } |
1192 class F { }'''); | 1134 class F { }'''); |
1193 addSource('/testG.dart', 'class G { }'); | 1135 addSource('/testG.dart', 'class G { }'); |
1194 addSource( | 1136 addSource('/testH.dart', ''' |
1195 '/testH.dart', | |
1196 ''' | |
1197 class H { } | 1137 class H { } |
1198 int T3; | 1138 int T3; |
1199 var _T4;'''); // not imported | 1139 var _T4;'''); // not imported |
1200 addTestSource(''' | 1140 addTestSource(''' |
1201 import "/testAB.dart"; | 1141 import "/testAB.dart"; |
1202 import "/testCD.dart" hide D; | 1142 import "/testCD.dart" hide D; |
1203 import "/testEEF.dart" show EE; | 1143 import "/testEEF.dart" show EE; |
1204 import "/testG.dart" as g; | 1144 import "/testG.dart" as g; |
1205 int T5; | 1145 int T5; |
1206 var _T6; | 1146 var _T6; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 assertNotSuggested('clog'); | 1210 assertNotSuggested('clog'); |
1271 assertNotSuggested('blog'); | 1211 assertNotSuggested('blog'); |
1272 // TODO (danrubel) suggest HtmlElement as low relevance | 1212 // TODO (danrubel) suggest HtmlElement as low relevance |
1273 assertNotSuggested('HtmlElement'); | 1213 assertNotSuggested('HtmlElement'); |
1274 assertNotSuggested('Uri'); | 1214 assertNotSuggested('Uri'); |
1275 assertNotSuggested('parseIPv6Address'); | 1215 assertNotSuggested('parseIPv6Address'); |
1276 assertNotSuggested('parseHex'); | 1216 assertNotSuggested('parseHex'); |
1277 } | 1217 } |
1278 | 1218 |
1279 test_Block_identifier_partial() async { | 1219 test_Block_identifier_partial() async { |
1280 addSource( | 1220 addSource('/testAB.dart', ''' |
1281 '/testAB.dart', | |
1282 ''' | |
1283 export "dart:math" hide max; | 1221 export "dart:math" hide max; |
1284 class A {int x;} | 1222 class A {int x;} |
1285 @deprecated D1() {int x;} | 1223 @deprecated D1() {int x;} |
1286 class _B { }'''); | 1224 class _B { }'''); |
1287 addSource( | 1225 addSource('/testCD.dart', ''' |
1288 '/testCD.dart', | |
1289 ''' | |
1290 String T1; | 1226 String T1; |
1291 var _T2; | 1227 var _T2; |
1292 class C { } | 1228 class C { } |
1293 class D { }'''); | 1229 class D { }'''); |
1294 addSource( | 1230 addSource('/testEEF.dart', ''' |
1295 '/testEEF.dart', | |
1296 ''' | |
1297 class EE { } | 1231 class EE { } |
1298 class F { }'''); | 1232 class F { }'''); |
1299 addSource('/testG.dart', 'class G { }'); | 1233 addSource('/testG.dart', 'class G { }'); |
1300 addSource( | 1234 addSource('/testH.dart', ''' |
1301 '/testH.dart', | |
1302 ''' | |
1303 class H { } | 1235 class H { } |
1304 class D3 { } | 1236 class D3 { } |
1305 int T3; | 1237 int T3; |
1306 var _T4;'''); // not imported | 1238 var _T4;'''); // not imported |
1307 addTestSource(''' | 1239 addTestSource(''' |
1308 import "/testAB.dart"; | 1240 import "/testAB.dart"; |
1309 import "/testCD.dart" hide D; | 1241 import "/testCD.dart" hide D; |
1310 import "/testEEF.dart" show EE; | 1242 import "/testEEF.dart" show EE; |
1311 import "/testG.dart" as g; | 1243 import "/testG.dart" as g; |
1312 int T5; | 1244 int T5; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 assertNotSuggested('_T4'); | 1290 assertNotSuggested('_T4'); |
1359 //assertSuggestTopLevelVar('T5', 'int', relevance: DART_RELEVANCE_LOCAL_TOP_
LEVEL_VARIABLE); | 1291 //assertSuggestTopLevelVar('T5', 'int', relevance: DART_RELEVANCE_LOCAL_TOP_
LEVEL_VARIABLE); |
1360 //assertSuggestTopLevelVar('_T6', null); | 1292 //assertSuggestTopLevelVar('_T6', null); |
1361 assertNotSuggested('=='); | 1293 assertNotSuggested('=='); |
1362 // TODO (danrubel) suggest HtmlElement as low relevance | 1294 // TODO (danrubel) suggest HtmlElement as low relevance |
1363 assertNotSuggested('HtmlElement'); | 1295 assertNotSuggested('HtmlElement'); |
1364 } | 1296 } |
1365 | 1297 |
1366 test_Block_inherited_imported() async { | 1298 test_Block_inherited_imported() async { |
1367 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | 1299 // Block BlockFunctionBody MethodDeclaration ClassDeclaration |
1368 resolveSource( | 1300 resolveSource('/testB.dart', ''' |
1369 '/testB.dart', | |
1370 ''' | |
1371 lib B; | 1301 lib B; |
1372 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } | 1302 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } |
1373 class E extends F { var e1; e2() { } } | 1303 class E extends F { var e1; e2() { } } |
1374 class I { int i1; i2() { } } | 1304 class I { int i1; i2() { } } |
1375 class M { var m1; int m2() { } }'''); | 1305 class M { var m1; int m2() { } }'''); |
1376 addTestSource(''' | 1306 addTestSource(''' |
1377 import "/testB.dart"; | 1307 import "/testB.dart"; |
1378 class A extends E implements I with M {a() {^}}'''); | 1308 class A extends E implements I with M {a() {^}}'''); |
1379 await computeSuggestions(); | 1309 await computeSuggestions(); |
1380 | 1310 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 assertNotSuggested('m1'); | 1344 assertNotSuggested('m1'); |
1415 assertNotSuggested('f3'); | 1345 assertNotSuggested('f3'); |
1416 assertNotSuggested('f4'); | 1346 assertNotSuggested('f4'); |
1417 assertNotSuggested('e2'); | 1347 assertNotSuggested('e2'); |
1418 assertNotSuggested('f2'); | 1348 assertNotSuggested('f2'); |
1419 assertNotSuggested('i2'); | 1349 assertNotSuggested('i2'); |
1420 assertNotSuggested('m2'); | 1350 assertNotSuggested('m2'); |
1421 } | 1351 } |
1422 | 1352 |
1423 test_Block_local_function() async { | 1353 test_Block_local_function() async { |
1424 addSource( | 1354 addSource('/testAB.dart', ''' |
1425 '/testAB.dart', | |
1426 ''' | |
1427 export "dart:math" hide max; | 1355 export "dart:math" hide max; |
1428 class A {int x;} | 1356 class A {int x;} |
1429 @deprecated D1() {int x;} | 1357 @deprecated D1() {int x;} |
1430 class _B {boo() { partBoo() {}} }'''); | 1358 class _B {boo() { partBoo() {}} }'''); |
1431 addSource( | 1359 addSource('/testCD.dart', ''' |
1432 '/testCD.dart', | |
1433 ''' | |
1434 String T1; | 1360 String T1; |
1435 var _T2; | 1361 var _T2; |
1436 class C { } | 1362 class C { } |
1437 class D { }'''); | 1363 class D { }'''); |
1438 addSource( | 1364 addSource('/testEEF.dart', ''' |
1439 '/testEEF.dart', | |
1440 ''' | |
1441 class EE { } | 1365 class EE { } |
1442 class F { }'''); | 1366 class F { }'''); |
1443 addSource('/testG.dart', 'class G { }'); | 1367 addSource('/testG.dart', 'class G { }'); |
1444 addSource( | 1368 addSource('/testH.dart', ''' |
1445 '/testH.dart', | |
1446 ''' | |
1447 class H { } | 1369 class H { } |
1448 int T3; | 1370 int T3; |
1449 var _T4;'''); // not imported | 1371 var _T4;'''); // not imported |
1450 addTestSource(''' | 1372 addTestSource(''' |
1451 import "/testAB.dart"; | 1373 import "/testAB.dart"; |
1452 import "/testCD.dart" hide D; | 1374 import "/testCD.dart" hide D; |
1453 import "/testEEF.dart" show EE; | 1375 import "/testEEF.dart" show EE; |
1454 import "/testG.dart" as g; | 1376 import "/testG.dart" as g; |
1455 int T5; | 1377 int T5; |
1456 var _T6; | 1378 var _T6; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 expect(replacementOffset, completionOffset - 1); | 1412 expect(replacementOffset, completionOffset - 1); |
1491 expect(replacementLength, 1); | 1413 expect(replacementLength, 1); |
1492 assertNotSuggested('Foo'); | 1414 assertNotSuggested('Foo'); |
1493 // TODO(danrubel) implement | 1415 // TODO(danrubel) implement |
1494 assertNotSuggested('Foo2'); | 1416 assertNotSuggested('Foo2'); |
1495 assertNotSuggested('Future'); | 1417 assertNotSuggested('Future'); |
1496 } | 1418 } |
1497 | 1419 |
1498 test_CascadeExpression_selector1() async { | 1420 test_CascadeExpression_selector1() async { |
1499 // PropertyAccess CascadeExpression ExpressionStatement Block | 1421 // PropertyAccess CascadeExpression ExpressionStatement Block |
1500 addSource( | 1422 addSource('/testB.dart', ''' |
1501 '/testB.dart', | |
1502 ''' | |
1503 class B { }'''); | 1423 class B { }'''); |
1504 addTestSource(''' | 1424 addTestSource(''' |
1505 import "/testB.dart"; | 1425 import "/testB.dart"; |
1506 class A {var b; X _c;} | 1426 class A {var b; X _c;} |
1507 class X{} | 1427 class X{} |
1508 // looks like a cascade to the parser | 1428 // looks like a cascade to the parser |
1509 // but the user is trying to get completions for a non-cascade | 1429 // but the user is trying to get completions for a non-cascade |
1510 main() {A a; a.^.z}'''); | 1430 main() {A a; a.^.z}'''); |
1511 await computeSuggestions(); | 1431 await computeSuggestions(); |
1512 | 1432 |
1513 expect(replacementOffset, completionOffset); | 1433 expect(replacementOffset, completionOffset); |
1514 expect(replacementLength, 0); | 1434 expect(replacementLength, 0); |
1515 assertNotSuggested('b'); | 1435 assertNotSuggested('b'); |
1516 assertNotSuggested('_c'); | 1436 assertNotSuggested('_c'); |
1517 assertNotSuggested('Object'); | 1437 assertNotSuggested('Object'); |
1518 assertNotSuggested('A'); | 1438 assertNotSuggested('A'); |
1519 assertNotSuggested('B'); | 1439 assertNotSuggested('B'); |
1520 assertNotSuggested('X'); | 1440 assertNotSuggested('X'); |
1521 assertNotSuggested('z'); | 1441 assertNotSuggested('z'); |
1522 assertNotSuggested('=='); | 1442 assertNotSuggested('=='); |
1523 } | 1443 } |
1524 | 1444 |
1525 test_CascadeExpression_selector2() async { | 1445 test_CascadeExpression_selector2() async { |
1526 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement | 1446 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement |
1527 addSource( | 1447 addSource('/testB.dart', ''' |
1528 '/testB.dart', | |
1529 ''' | |
1530 class B { }'''); | 1448 class B { }'''); |
1531 addTestSource(''' | 1449 addTestSource(''' |
1532 import "/testB.dart"; | 1450 import "/testB.dart"; |
1533 class A {var b; X _c;} | 1451 class A {var b; X _c;} |
1534 class X{} | 1452 class X{} |
1535 main() {A a; a..^z}'''); | 1453 main() {A a; a..^z}'''); |
1536 await computeSuggestions(); | 1454 await computeSuggestions(); |
1537 | 1455 |
1538 expect(replacementOffset, completionOffset); | 1456 expect(replacementOffset, completionOffset); |
1539 expect(replacementLength, 1); | 1457 expect(replacementLength, 1); |
1540 assertNotSuggested('b'); | 1458 assertNotSuggested('b'); |
1541 assertNotSuggested('_c'); | 1459 assertNotSuggested('_c'); |
1542 assertNotSuggested('Object'); | 1460 assertNotSuggested('Object'); |
1543 assertNotSuggested('A'); | 1461 assertNotSuggested('A'); |
1544 assertNotSuggested('B'); | 1462 assertNotSuggested('B'); |
1545 assertNotSuggested('X'); | 1463 assertNotSuggested('X'); |
1546 assertNotSuggested('z'); | 1464 assertNotSuggested('z'); |
1547 assertNotSuggested('=='); | 1465 assertNotSuggested('=='); |
1548 } | 1466 } |
1549 | 1467 |
1550 test_CascadeExpression_selector2_withTrailingReturn() async { | 1468 test_CascadeExpression_selector2_withTrailingReturn() async { |
1551 // PropertyAccess CascadeExpression ExpressionStatement Block | 1469 // PropertyAccess CascadeExpression ExpressionStatement Block |
1552 addSource( | 1470 addSource('/testB.dart', ''' |
1553 '/testB.dart', | |
1554 ''' | |
1555 class B { }'''); | 1471 class B { }'''); |
1556 addTestSource(''' | 1472 addTestSource(''' |
1557 import "/testB.dart"; | 1473 import "/testB.dart"; |
1558 class A {var b; X _c;} | 1474 class A {var b; X _c;} |
1559 class X{} | 1475 class X{} |
1560 main() {A a; a..^ return}'''); | 1476 main() {A a; a..^ return}'''); |
1561 await computeSuggestions(); | 1477 await computeSuggestions(); |
1562 | 1478 |
1563 expect(replacementOffset, completionOffset); | 1479 expect(replacementOffset, completionOffset); |
1564 expect(replacementLength, 0); | 1480 expect(replacementLength, 0); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 expect(replacementLength, 0); | 1555 expect(replacementLength, 0); |
1640 assertSuggestParameter('e', null); | 1556 assertSuggestParameter('e', null); |
1641 assertSuggestParameter('s', 'StackTrace'); | 1557 assertSuggestParameter('s', 'StackTrace'); |
1642 assertSuggestMethod('a', 'A', null, relevance: DART_RELEVANCE_LOCAL_METHOD); | 1558 assertSuggestMethod('a', 'A', null, relevance: DART_RELEVANCE_LOCAL_METHOD); |
1643 assertNotSuggested('Object'); | 1559 assertNotSuggested('Object'); |
1644 assertNotSuggested('x'); | 1560 assertNotSuggested('x'); |
1645 } | 1561 } |
1646 | 1562 |
1647 test_ClassDeclaration_body() async { | 1563 test_ClassDeclaration_body() async { |
1648 // ClassDeclaration CompilationUnit | 1564 // ClassDeclaration CompilationUnit |
1649 addSource( | 1565 addSource('/testB.dart', ''' |
1650 '/testB.dart', | |
1651 ''' | |
1652 class B { }'''); | 1566 class B { }'''); |
1653 addTestSource(''' | 1567 addTestSource(''' |
1654 import "testB.dart" as x; | 1568 import "testB.dart" as x; |
1655 @deprecated class A {^} | 1569 @deprecated class A {^} |
1656 class _B {} | 1570 class _B {} |
1657 A T;'''); | 1571 A T;'''); |
1658 await computeSuggestions(); | 1572 await computeSuggestions(); |
1659 | 1573 |
1660 expect(replacementOffset, completionOffset); | 1574 expect(replacementOffset, completionOffset); |
1661 expect(replacementLength, 0); | 1575 expect(replacementLength, 0); |
1662 CompletionSuggestion suggestionA = assertSuggestClass('A', | 1576 CompletionSuggestion suggestionA = assertSuggestClass('A', |
1663 relevance: DART_RELEVANCE_LOW, isDeprecated: true); | 1577 relevance: DART_RELEVANCE_LOW, isDeprecated: true); |
1664 if (suggestionA != null) { | 1578 if (suggestionA != null) { |
1665 expect(suggestionA.element.isDeprecated, isTrue); | 1579 expect(suggestionA.element.isDeprecated, isTrue); |
1666 expect(suggestionA.element.isPrivate, isFalse); | 1580 expect(suggestionA.element.isPrivate, isFalse); |
1667 } | 1581 } |
1668 CompletionSuggestion suggestionB = assertSuggestClass('_B'); | 1582 CompletionSuggestion suggestionB = assertSuggestClass('_B'); |
1669 if (suggestionB != null) { | 1583 if (suggestionB != null) { |
1670 expect(suggestionB.element.isDeprecated, isFalse); | 1584 expect(suggestionB.element.isDeprecated, isFalse); |
1671 expect(suggestionB.element.isPrivate, isTrue); | 1585 expect(suggestionB.element.isPrivate, isTrue); |
1672 } | 1586 } |
1673 assertNotSuggested('Object'); | 1587 assertNotSuggested('Object'); |
1674 assertNotSuggested('T'); | 1588 assertNotSuggested('T'); |
1675 // Suggested by LibraryPrefixContributor | 1589 // Suggested by LibraryPrefixContributor |
1676 assertNotSuggested('x'); | 1590 assertNotSuggested('x'); |
1677 } | 1591 } |
1678 | 1592 |
1679 test_ClassDeclaration_body_final() async { | 1593 test_ClassDeclaration_body_final() async { |
1680 // ClassDeclaration CompilationUnit | 1594 // ClassDeclaration CompilationUnit |
1681 addSource( | 1595 addSource('/testB.dart', ''' |
1682 '/testB.dart', | |
1683 ''' | |
1684 class B { }'''); | 1596 class B { }'''); |
1685 addTestSource(''' | 1597 addTestSource(''' |
1686 import "testB.dart" as x; | 1598 import "testB.dart" as x; |
1687 class A {final ^} | 1599 class A {final ^} |
1688 class _B {} | 1600 class _B {} |
1689 A T;'''); | 1601 A T;'''); |
1690 await computeSuggestions(); | 1602 await computeSuggestions(); |
1691 | 1603 |
1692 expect(replacementOffset, completionOffset); | 1604 expect(replacementOffset, completionOffset); |
1693 expect(replacementLength, 0); | 1605 expect(replacementLength, 0); |
1694 assertSuggestClass('A'); | 1606 assertSuggestClass('A'); |
1695 assertSuggestClass('_B'); | 1607 assertSuggestClass('_B'); |
1696 assertNotSuggested('Object'); | 1608 assertNotSuggested('Object'); |
1697 assertNotSuggested('T'); | 1609 assertNotSuggested('T'); |
1698 // Suggested by LibraryPrefixContributor | 1610 // Suggested by LibraryPrefixContributor |
1699 assertNotSuggested('x'); | 1611 assertNotSuggested('x'); |
1700 } | 1612 } |
1701 | 1613 |
1702 test_ClassDeclaration_body_final_field() async { | 1614 test_ClassDeclaration_body_final_field() async { |
1703 // ClassDeclaration CompilationUnit | 1615 // ClassDeclaration CompilationUnit |
1704 addSource( | 1616 addSource('/testB.dart', ''' |
1705 '/testB.dart', | |
1706 ''' | |
1707 class B { }'''); | 1617 class B { }'''); |
1708 addTestSource(''' | 1618 addTestSource(''' |
1709 import "testB.dart" as x; | 1619 import "testB.dart" as x; |
1710 class A {final ^ A(){}} | 1620 class A {final ^ A(){}} |
1711 class _B {} | 1621 class _B {} |
1712 A T;'''); | 1622 A T;'''); |
1713 await computeSuggestions(); | 1623 await computeSuggestions(); |
1714 | 1624 |
1715 expect(replacementOffset, completionOffset); | 1625 expect(replacementOffset, completionOffset); |
1716 expect(replacementLength, 0); | 1626 expect(replacementLength, 0); |
1717 assertSuggestClass('A'); | 1627 assertSuggestClass('A'); |
1718 assertSuggestClass('_B'); | 1628 assertSuggestClass('_B'); |
1719 assertNotSuggested('String'); | 1629 assertNotSuggested('String'); |
1720 assertNotSuggested('T'); | 1630 assertNotSuggested('T'); |
1721 // Suggested by LibraryPrefixContributor | 1631 // Suggested by LibraryPrefixContributor |
1722 assertNotSuggested('x'); | 1632 assertNotSuggested('x'); |
1723 } | 1633 } |
1724 | 1634 |
1725 test_ClassDeclaration_body_final_field2() async { | 1635 test_ClassDeclaration_body_final_field2() async { |
1726 // ClassDeclaration CompilationUnit | 1636 // ClassDeclaration CompilationUnit |
1727 addSource( | 1637 addSource('/testB.dart', ''' |
1728 '/testB.dart', | |
1729 ''' | |
1730 class B { }'''); | 1638 class B { }'''); |
1731 addTestSource(''' | 1639 addTestSource(''' |
1732 import "testB.dart" as Soo; | 1640 import "testB.dart" as Soo; |
1733 class A {final S^ A();} | 1641 class A {final S^ A();} |
1734 class _B {} | 1642 class _B {} |
1735 A Sew;'''); | 1643 A Sew;'''); |
1736 await computeSuggestions(); | 1644 await computeSuggestions(); |
1737 | 1645 |
1738 expect(replacementOffset, completionOffset - 1); | 1646 expect(replacementOffset, completionOffset - 1); |
1739 expect(replacementLength, 1); | 1647 expect(replacementLength, 1); |
1740 assertSuggestClass('A'); | 1648 assertSuggestClass('A'); |
1741 assertSuggestClass('_B'); | 1649 assertSuggestClass('_B'); |
1742 assertNotSuggested('String'); | 1650 assertNotSuggested('String'); |
1743 assertNotSuggested('Sew'); | 1651 assertNotSuggested('Sew'); |
1744 // Suggested by LibraryPrefixContributor | 1652 // Suggested by LibraryPrefixContributor |
1745 assertNotSuggested('Soo'); | 1653 assertNotSuggested('Soo'); |
1746 } | 1654 } |
1747 | 1655 |
1748 test_ClassDeclaration_body_final_final() async { | 1656 test_ClassDeclaration_body_final_final() async { |
1749 // ClassDeclaration CompilationUnit | 1657 // ClassDeclaration CompilationUnit |
1750 addSource( | 1658 addSource('/testB.dart', ''' |
1751 '/testB.dart', | |
1752 ''' | |
1753 class B { }'''); | 1659 class B { }'''); |
1754 addTestSource(''' | 1660 addTestSource(''' |
1755 import "testB.dart" as x; | 1661 import "testB.dart" as x; |
1756 class A {final ^ final foo;} | 1662 class A {final ^ final foo;} |
1757 class _B {} | 1663 class _B {} |
1758 A T;'''); | 1664 A T;'''); |
1759 await computeSuggestions(); | 1665 await computeSuggestions(); |
1760 | 1666 |
1761 expect(replacementOffset, completionOffset); | 1667 expect(replacementOffset, completionOffset); |
1762 expect(replacementLength, 0); | 1668 expect(replacementLength, 0); |
1763 assertSuggestClass('A'); | 1669 assertSuggestClass('A'); |
1764 assertSuggestClass('_B'); | 1670 assertSuggestClass('_B'); |
1765 assertNotSuggested('Object'); | 1671 assertNotSuggested('Object'); |
1766 assertNotSuggested('T'); | 1672 assertNotSuggested('T'); |
1767 // Suggested by LibraryPrefixContributor | 1673 // Suggested by LibraryPrefixContributor |
1768 assertNotSuggested('x'); | 1674 assertNotSuggested('x'); |
1769 } | 1675 } |
1770 | 1676 |
1771 test_ClassDeclaration_body_final_var() async { | 1677 test_ClassDeclaration_body_final_var() async { |
1772 // ClassDeclaration CompilationUnit | 1678 // ClassDeclaration CompilationUnit |
1773 addSource( | 1679 addSource('/testB.dart', ''' |
1774 '/testB.dart', | |
1775 ''' | |
1776 class B { }'''); | 1680 class B { }'''); |
1777 addTestSource(''' | 1681 addTestSource(''' |
1778 import "testB.dart" as x; | 1682 import "testB.dart" as x; |
1779 class A {final ^ var foo;} | 1683 class A {final ^ var foo;} |
1780 class _B {} | 1684 class _B {} |
1781 A T;'''); | 1685 A T;'''); |
1782 await computeSuggestions(); | 1686 await computeSuggestions(); |
1783 | 1687 |
1784 expect(replacementOffset, completionOffset); | 1688 expect(replacementOffset, completionOffset); |
1785 expect(replacementLength, 0); | 1689 expect(replacementLength, 0); |
1786 assertSuggestClass('A'); | 1690 assertSuggestClass('A'); |
1787 assertSuggestClass('_B'); | 1691 assertSuggestClass('_B'); |
1788 assertNotSuggested('Object'); | 1692 assertNotSuggested('Object'); |
1789 assertNotSuggested('T'); | 1693 assertNotSuggested('T'); |
1790 // Suggested by LibraryPrefixContributor | 1694 // Suggested by LibraryPrefixContributor |
1791 assertNotSuggested('x'); | 1695 assertNotSuggested('x'); |
1792 } | 1696 } |
1793 | 1697 |
1794 test_Combinator_hide() async { | 1698 test_Combinator_hide() async { |
1795 // SimpleIdentifier HideCombinator ImportDirective | 1699 // SimpleIdentifier HideCombinator ImportDirective |
1796 addSource( | 1700 addSource('/testAB.dart', ''' |
1797 '/testAB.dart', | |
1798 ''' | |
1799 library libAB; | 1701 library libAB; |
1800 part '/partAB.dart'; | 1702 part '/partAB.dart'; |
1801 class A { } | 1703 class A { } |
1802 class B { }'''); | 1704 class B { }'''); |
1803 addSource( | 1705 addSource('/partAB.dart', ''' |
1804 '/partAB.dart', | |
1805 ''' | |
1806 part of libAB; | 1706 part of libAB; |
1807 var T1; | 1707 var T1; |
1808 PB F1() => new PB(); | 1708 PB F1() => new PB(); |
1809 class PB { }'''); | 1709 class PB { }'''); |
1810 addSource( | 1710 addSource('/testCD.dart', ''' |
1811 '/testCD.dart', | |
1812 ''' | |
1813 class C { } | 1711 class C { } |
1814 class D { }'''); | 1712 class D { }'''); |
1815 addTestSource(''' | 1713 addTestSource(''' |
1816 import "/testAB.dart" hide ^; | 1714 import "/testAB.dart" hide ^; |
1817 import "/testCD.dart"; | 1715 import "/testCD.dart"; |
1818 class X {}'''); | 1716 class X {}'''); |
1819 await computeSuggestions(); | 1717 await computeSuggestions(); |
1820 | 1718 |
1821 assertNoSuggestions(); | 1719 assertNoSuggestions(); |
1822 } | 1720 } |
1823 | 1721 |
1824 test_Combinator_show() async { | 1722 test_Combinator_show() async { |
1825 // SimpleIdentifier HideCombinator ImportDirective | 1723 // SimpleIdentifier HideCombinator ImportDirective |
1826 addSource( | 1724 addSource('/testAB.dart', ''' |
1827 '/testAB.dart', | |
1828 ''' | |
1829 library libAB; | 1725 library libAB; |
1830 part '/partAB.dart'; | 1726 part '/partAB.dart'; |
1831 class A { } | 1727 class A { } |
1832 class B { }'''); | 1728 class B { }'''); |
1833 addSource( | 1729 addSource('/partAB.dart', ''' |
1834 '/partAB.dart', | |
1835 ''' | |
1836 part of libAB; | 1730 part of libAB; |
1837 var T1; | 1731 var T1; |
1838 PB F1() => new PB(); | 1732 PB F1() => new PB(); |
1839 typedef PB2 F2(int blat); | 1733 typedef PB2 F2(int blat); |
1840 class Clz = Object with Object; | 1734 class Clz = Object with Object; |
1841 class PB { }'''); | 1735 class PB { }'''); |
1842 addSource( | 1736 addSource('/testCD.dart', ''' |
1843 '/testCD.dart', | |
1844 ''' | |
1845 class C { } | 1737 class C { } |
1846 class D { }'''); | 1738 class D { }'''); |
1847 addTestSource(''' | 1739 addTestSource(''' |
1848 import "/testAB.dart" show ^; | 1740 import "/testAB.dart" show ^; |
1849 import "/testCD.dart"; | 1741 import "/testCD.dart"; |
1850 class X {}'''); | 1742 class X {}'''); |
1851 await computeSuggestions(); | 1743 await computeSuggestions(); |
1852 | 1744 |
1853 assertNoSuggestions(); | 1745 assertNoSuggestions(); |
1854 } | 1746 } |
1855 | 1747 |
1856 test_ConditionalExpression_elseExpression() async { | 1748 test_ConditionalExpression_elseExpression() async { |
1857 // SimpleIdentifier ConditionalExpression ReturnStatement | 1749 // SimpleIdentifier ConditionalExpression ReturnStatement |
1858 addSource( | 1750 addSource('/testA.dart', ''' |
1859 '/testA.dart', | |
1860 ''' | |
1861 int T1; | 1751 int T1; |
1862 F1() { } | 1752 F1() { } |
1863 class A {int x;}'''); | 1753 class A {int x;}'''); |
1864 addTestSource(''' | 1754 addTestSource(''' |
1865 import "/testA.dart"; | 1755 import "/testA.dart"; |
1866 int T2; | 1756 int T2; |
1867 F2() { } | 1757 F2() { } |
1868 class B {int x;} | 1758 class B {int x;} |
1869 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); | 1759 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); |
1870 await computeSuggestions(); | 1760 await computeSuggestions(); |
1871 | 1761 |
1872 // top level results are partially filtered based on first char | 1762 // top level results are partially filtered based on first char |
1873 assertSuggestTopLevelVar('T2', 'int', | 1763 assertSuggestTopLevelVar('T2', 'int', |
1874 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 1764 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
1875 // TODO (danrubel) getter is being suggested instead of top level var | 1765 // TODO (danrubel) getter is being suggested instead of top level var |
1876 //assertNotSuggested('T1'); | 1766 //assertNotSuggested('T1'); |
1877 } | 1767 } |
1878 | 1768 |
1879 test_ConditionalExpression_elseExpression_empty() async { | 1769 test_ConditionalExpression_elseExpression_empty() async { |
1880 // SimpleIdentifier ConditionalExpression ReturnStatement | 1770 // SimpleIdentifier ConditionalExpression ReturnStatement |
1881 addSource( | 1771 addSource('/testA.dart', ''' |
1882 '/testA.dart', | |
1883 ''' | |
1884 int T1; | 1772 int T1; |
1885 F1() { } | 1773 F1() { } |
1886 class A {int x;}'''); | 1774 class A {int x;}'''); |
1887 addTestSource(''' | 1775 addTestSource(''' |
1888 import "/testA.dart"; | 1776 import "/testA.dart"; |
1889 int T2; | 1777 int T2; |
1890 F2() { } | 1778 F2() { } |
1891 class B {int x;} | 1779 class B {int x;} |
1892 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); | 1780 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); |
1893 await computeSuggestions(); | 1781 await computeSuggestions(); |
1894 | 1782 |
1895 assertNotSuggested('x'); | 1783 assertNotSuggested('x'); |
1896 assertSuggestLocalVariable('f', null); | 1784 assertSuggestLocalVariable('f', null); |
1897 assertSuggestMethod('foo', 'C', null, | 1785 assertSuggestMethod('foo', 'C', null, |
1898 relevance: DART_RELEVANCE_LOCAL_METHOD); | 1786 relevance: DART_RELEVANCE_LOCAL_METHOD); |
1899 assertSuggestClass('C'); | 1787 assertSuggestClass('C'); |
1900 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 1788 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
1901 assertSuggestTopLevelVar('T2', 'int', | 1789 assertSuggestTopLevelVar('T2', 'int', |
1902 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 1790 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
1903 assertNotSuggested('A'); | 1791 assertNotSuggested('A'); |
1904 assertNotSuggested('F1'); | 1792 assertNotSuggested('F1'); |
1905 // TODO (danrubel) getter is being suggested instead of top level var | 1793 // TODO (danrubel) getter is being suggested instead of top level var |
1906 //assertNotSuggested('T1'); | 1794 //assertNotSuggested('T1'); |
1907 } | 1795 } |
1908 | 1796 |
1909 test_ConditionalExpression_partial_thenExpression() async { | 1797 test_ConditionalExpression_partial_thenExpression() async { |
1910 // SimpleIdentifier ConditionalExpression ReturnStatement | 1798 // SimpleIdentifier ConditionalExpression ReturnStatement |
1911 addSource( | 1799 addSource('/testA.dart', ''' |
1912 '/testA.dart', | |
1913 ''' | |
1914 int T1; | 1800 int T1; |
1915 F1() { } | 1801 F1() { } |
1916 class A {int x;}'''); | 1802 class A {int x;}'''); |
1917 addTestSource(''' | 1803 addTestSource(''' |
1918 import "/testA.dart"; | 1804 import "/testA.dart"; |
1919 int T2; | 1805 int T2; |
1920 F2() { } | 1806 F2() { } |
1921 class B {int x;} | 1807 class B {int x;} |
1922 class C {foo(){var f; {var x;} return a ? T^}}'''); | 1808 class C {foo(){var f; {var x;} return a ? T^}}'''); |
1923 await computeSuggestions(); | 1809 await computeSuggestions(); |
1924 | 1810 |
1925 // top level results are partially filtered based on first char | 1811 // top level results are partially filtered based on first char |
1926 assertSuggestTopLevelVar('T2', 'int', | 1812 assertSuggestTopLevelVar('T2', 'int', |
1927 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 1813 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
1928 // TODO (danrubel) getter is being suggested instead of top level var | 1814 // TODO (danrubel) getter is being suggested instead of top level var |
1929 //assertNotSuggested('T1'); | 1815 //assertNotSuggested('T1'); |
1930 } | 1816 } |
1931 | 1817 |
1932 test_ConditionalExpression_partial_thenExpression_empty() async { | 1818 test_ConditionalExpression_partial_thenExpression_empty() async { |
1933 // SimpleIdentifier ConditionalExpression ReturnStatement | 1819 // SimpleIdentifier ConditionalExpression ReturnStatement |
1934 addSource( | 1820 addSource('/testA.dart', ''' |
1935 '/testA.dart', | |
1936 ''' | |
1937 int T1; | 1821 int T1; |
1938 F1() { } | 1822 F1() { } |
1939 class A {int x;}'''); | 1823 class A {int x;}'''); |
1940 addTestSource(''' | 1824 addTestSource(''' |
1941 import "/testA.dart"; | 1825 import "/testA.dart"; |
1942 int T2; | 1826 int T2; |
1943 F2() { } | 1827 F2() { } |
1944 class B {int x;} | 1828 class B {int x;} |
1945 class C {foo(){var f; {var x;} return a ? ^}}'''); | 1829 class C {foo(){var f; {var x;} return a ? ^}}'''); |
1946 await computeSuggestions(); | 1830 await computeSuggestions(); |
1947 | 1831 |
1948 assertNotSuggested('x'); | 1832 assertNotSuggested('x'); |
1949 assertSuggestLocalVariable('f', null); | 1833 assertSuggestLocalVariable('f', null); |
1950 assertSuggestMethod('foo', 'C', null, | 1834 assertSuggestMethod('foo', 'C', null, |
1951 relevance: DART_RELEVANCE_LOCAL_METHOD); | 1835 relevance: DART_RELEVANCE_LOCAL_METHOD); |
1952 assertSuggestClass('C'); | 1836 assertSuggestClass('C'); |
1953 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 1837 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
1954 assertSuggestTopLevelVar('T2', 'int', | 1838 assertSuggestTopLevelVar('T2', 'int', |
1955 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 1839 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
1956 assertNotSuggested('A'); | 1840 assertNotSuggested('A'); |
1957 assertNotSuggested('F1'); | 1841 assertNotSuggested('F1'); |
1958 // TODO (danrubel) getter is being suggested instead of top level var | 1842 // TODO (danrubel) getter is being suggested instead of top level var |
1959 //assertNotSuggested('T1'); | 1843 //assertNotSuggested('T1'); |
1960 } | 1844 } |
1961 | 1845 |
1962 test_ConditionalExpression_thenExpression() async { | 1846 test_ConditionalExpression_thenExpression() async { |
1963 // SimpleIdentifier ConditionalExpression ReturnStatement | 1847 // SimpleIdentifier ConditionalExpression ReturnStatement |
1964 addSource( | 1848 addSource('/testA.dart', ''' |
1965 '/testA.dart', | |
1966 ''' | |
1967 int T1; | 1849 int T1; |
1968 F1() { } | 1850 F1() { } |
1969 class A {int x;}'''); | 1851 class A {int x;}'''); |
1970 addTestSource(''' | 1852 addTestSource(''' |
1971 import "/testA.dart"; | 1853 import "/testA.dart"; |
1972 int T2; | 1854 int T2; |
1973 F2() { } | 1855 F2() { } |
1974 class B {int x;} | 1856 class B {int x;} |
1975 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); | 1857 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); |
1976 await computeSuggestions(); | 1858 await computeSuggestions(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 test_constructor_parameters_required() async { | 1895 test_constructor_parameters_required() async { |
2014 addTestSource('class A {A(x, int y) {^}}'); | 1896 addTestSource('class A {A(x, int y) {^}}'); |
2015 await computeSuggestions(); | 1897 await computeSuggestions(); |
2016 assertSuggestParameter('x', null); | 1898 assertSuggestParameter('x', null); |
2017 assertSuggestParameter('y', 'int'); | 1899 assertSuggestParameter('y', 'int'); |
2018 } | 1900 } |
2019 | 1901 |
2020 test_ConstructorName_importedClass() async { | 1902 test_ConstructorName_importedClass() async { |
2021 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1903 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
2022 // InstanceCreationExpression | 1904 // InstanceCreationExpression |
2023 addSource( | 1905 addSource('/testB.dart', ''' |
2024 '/testB.dart', | |
2025 ''' | |
2026 lib B; | 1906 lib B; |
2027 int T1; | 1907 int T1; |
2028 F1() { } | 1908 F1() { } |
2029 class X {X.c(); X._d(); z() {}}'''); | 1909 class X {X.c(); X._d(); z() {}}'''); |
2030 addTestSource(''' | 1910 addTestSource(''' |
2031 import "/testB.dart"; | 1911 import "/testB.dart"; |
2032 var m; | 1912 var m; |
2033 main() {new X.^}'''); | 1913 main() {new X.^}'''); |
2034 await computeSuggestions(); | 1914 await computeSuggestions(); |
2035 | 1915 |
2036 expect(replacementOffset, completionOffset); | 1916 expect(replacementOffset, completionOffset); |
2037 expect(replacementLength, 0); | 1917 expect(replacementLength, 0); |
2038 // Suggested by NamedConstructorContributor | 1918 // Suggested by NamedConstructorContributor |
2039 assertNotSuggested('c'); | 1919 assertNotSuggested('c'); |
2040 assertNotSuggested('F1'); | 1920 assertNotSuggested('F1'); |
2041 assertNotSuggested('T1'); | 1921 assertNotSuggested('T1'); |
2042 assertNotSuggested('_d'); | 1922 assertNotSuggested('_d'); |
2043 assertNotSuggested('z'); | 1923 assertNotSuggested('z'); |
2044 assertNotSuggested('m'); | 1924 assertNotSuggested('m'); |
2045 } | 1925 } |
2046 | 1926 |
2047 test_ConstructorName_importedFactory() async { | 1927 test_ConstructorName_importedFactory() async { |
2048 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1928 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
2049 // InstanceCreationExpression | 1929 // InstanceCreationExpression |
2050 addSource( | 1930 addSource('/testB.dart', ''' |
2051 '/testB.dart', | |
2052 ''' | |
2053 lib B; | 1931 lib B; |
2054 int T1; | 1932 int T1; |
2055 F1() { } | 1933 F1() { } |
2056 class X {factory X.c(); factory X._d(); z() {}}'''); | 1934 class X {factory X.c(); factory X._d(); z() {}}'''); |
2057 addTestSource(''' | 1935 addTestSource(''' |
2058 import "/testB.dart"; | 1936 import "/testB.dart"; |
2059 var m; | 1937 var m; |
2060 main() {new X.^}'''); | 1938 main() {new X.^}'''); |
2061 await computeSuggestions(); | 1939 await computeSuggestions(); |
2062 | 1940 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); | 2172 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); |
2295 assertSuggestEnumConst('E.two', | 2173 assertSuggestEnumConst('E.two', |
2296 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); | 2174 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); |
2297 assertNotSuggested('a'); | 2175 assertNotSuggested('a'); |
2298 assertNotSuggested('F.three'); | 2176 assertNotSuggested('F.three'); |
2299 assertNotSuggested('F.four'); | 2177 assertNotSuggested('F.four'); |
2300 } | 2178 } |
2301 | 2179 |
2302 test_ExpressionStatement_identifier() async { | 2180 test_ExpressionStatement_identifier() async { |
2303 // SimpleIdentifier ExpressionStatement Block | 2181 // SimpleIdentifier ExpressionStatement Block |
2304 addSource( | 2182 addSource('/testA.dart', ''' |
2305 '/testA.dart', | |
2306 ''' | |
2307 _B F1() { } | 2183 _B F1() { } |
2308 class A {int x;} | 2184 class A {int x;} |
2309 class _B { }'''); | 2185 class _B { }'''); |
2310 addTestSource(''' | 2186 addTestSource(''' |
2311 import "/testA.dart"; | 2187 import "/testA.dart"; |
2312 typedef int F2(int blat); | 2188 typedef int F2(int blat); |
2313 class Clz = Object with Object; | 2189 class Clz = Object with Object; |
2314 class C {foo(){^} void bar() {}}'''); | 2190 class C {foo(){^} void bar() {}}'''); |
2315 await computeSuggestions(); | 2191 await computeSuggestions(); |
2316 | 2192 |
2317 expect(replacementOffset, completionOffset); | 2193 expect(replacementOffset, completionOffset); |
2318 expect(replacementLength, 0); | 2194 expect(replacementLength, 0); |
2319 assertNotSuggested('A'); | 2195 assertNotSuggested('A'); |
2320 assertNotSuggested('F1'); | 2196 assertNotSuggested('F1'); |
2321 assertSuggestClass('C'); | 2197 assertSuggestClass('C'); |
2322 assertSuggestMethod('foo', 'C', null, | 2198 assertSuggestMethod('foo', 'C', null, |
2323 relevance: DART_RELEVANCE_LOCAL_METHOD); | 2199 relevance: DART_RELEVANCE_LOCAL_METHOD); |
2324 assertSuggestMethod('bar', 'C', 'void', | 2200 assertSuggestMethod('bar', 'C', 'void', |
2325 relevance: DART_RELEVANCE_LOCAL_METHOD); | 2201 relevance: DART_RELEVANCE_LOCAL_METHOD); |
2326 assertSuggestFunctionTypeAlias('F2', 'int'); | 2202 assertSuggestFunctionTypeAlias('F2', 'int'); |
2327 assertSuggestClassTypeAlias('Clz'); | 2203 assertSuggestClassTypeAlias('Clz'); |
2328 assertSuggestClass('C'); | 2204 assertSuggestClass('C'); |
2329 assertNotSuggested('x'); | 2205 assertNotSuggested('x'); |
2330 assertNotSuggested('_B'); | 2206 assertNotSuggested('_B'); |
2331 } | 2207 } |
2332 | 2208 |
2333 test_ExpressionStatement_name() async { | 2209 test_ExpressionStatement_name() async { |
2334 // ExpressionStatement Block BlockFunctionBody MethodDeclaration | 2210 // ExpressionStatement Block BlockFunctionBody MethodDeclaration |
2335 addSource( | 2211 addSource('/testA.dart', ''' |
2336 '/testA.dart', | |
2337 ''' | |
2338 B T1; | 2212 B T1; |
2339 class B{}'''); | 2213 class B{}'''); |
2340 addTestSource(''' | 2214 addTestSource(''' |
2341 import "/testA.dart"; | 2215 import "/testA.dart"; |
2342 class C {a() {C ^}}'''); | 2216 class C {a() {C ^}}'''); |
2343 await computeSuggestions(); | 2217 await computeSuggestions(); |
2344 | 2218 |
2345 assertNoSuggestions(); | 2219 assertNoSuggestions(); |
2346 } | 2220 } |
2347 | 2221 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 expect(suggestion.parameterNames[0], 'x'); | 2538 expect(suggestion.parameterNames[0], 'x'); |
2665 expect(suggestion.parameterTypes[0], 'dynamic'); | 2539 expect(suggestion.parameterTypes[0], 'dynamic'); |
2666 expect(suggestion.parameterNames[1], 'y'); | 2540 expect(suggestion.parameterNames[1], 'y'); |
2667 expect(suggestion.parameterTypes[1], 'int'); | 2541 expect(suggestion.parameterTypes[1], 'int'); |
2668 expect(suggestion.requiredParameterCount, 2); | 2542 expect(suggestion.requiredParameterCount, 2); |
2669 expect(suggestion.hasNamedParameters, false); | 2543 expect(suggestion.hasNamedParameters, false); |
2670 } | 2544 } |
2671 | 2545 |
2672 test_FunctionDeclaration_returnType_afterComment() async { | 2546 test_FunctionDeclaration_returnType_afterComment() async { |
2673 // ClassDeclaration CompilationUnit | 2547 // ClassDeclaration CompilationUnit |
2674 addSource( | 2548 addSource('/testA.dart', ''' |
2675 '/testA.dart', | |
2676 ''' | |
2677 int T1; | 2549 int T1; |
2678 F1() { } | 2550 F1() { } |
2679 typedef D1(); | 2551 typedef D1(); |
2680 class C1 {C1(this.x) { } int x;}'''); | 2552 class C1 {C1(this.x) { } int x;}'''); |
2681 addTestSource(''' | 2553 addTestSource(''' |
2682 import "/testA.dart"; | 2554 import "/testA.dart"; |
2683 int T2; | 2555 int T2; |
2684 F2() { } | 2556 F2() { } |
2685 typedef D2(); | 2557 typedef D2(); |
2686 class C2 { } | 2558 class C2 { } |
2687 /* */ ^ zoo(z) { } String name;'''); | 2559 /* */ ^ zoo(z) { } String name;'''); |
2688 await computeSuggestions(); | 2560 await computeSuggestions(); |
2689 | 2561 |
2690 expect(replacementOffset, completionOffset); | 2562 expect(replacementOffset, completionOffset); |
2691 expect(replacementLength, 0); | 2563 expect(replacementLength, 0); |
2692 assertNotSuggested('Object'); | 2564 assertNotSuggested('Object'); |
2693 assertNotSuggested('T1'); | 2565 assertNotSuggested('T1'); |
2694 assertNotSuggested('F1'); | 2566 assertNotSuggested('F1'); |
2695 assertNotSuggested('D1'); | 2567 assertNotSuggested('D1'); |
2696 assertNotSuggested('C1'); | 2568 assertNotSuggested('C1'); |
2697 assertNotSuggested('T2'); | 2569 assertNotSuggested('T2'); |
2698 assertNotSuggested('F2'); | 2570 assertNotSuggested('F2'); |
2699 assertSuggestFunctionTypeAlias('D2', null); | 2571 assertSuggestFunctionTypeAlias('D2', null); |
2700 assertSuggestClass('C2'); | 2572 assertSuggestClass('C2'); |
2701 assertNotSuggested('name'); | 2573 assertNotSuggested('name'); |
2702 } | 2574 } |
2703 | 2575 |
2704 test_FunctionDeclaration_returnType_afterComment2() async { | 2576 test_FunctionDeclaration_returnType_afterComment2() async { |
2705 // FunctionDeclaration ClassDeclaration CompilationUnit | 2577 // FunctionDeclaration ClassDeclaration CompilationUnit |
2706 addSource( | 2578 addSource('/testA.dart', ''' |
2707 '/testA.dart', | |
2708 ''' | |
2709 int T1; | 2579 int T1; |
2710 F1() { } | 2580 F1() { } |
2711 typedef D1(); | 2581 typedef D1(); |
2712 class C1 {C1(this.x) { } int x;}'''); | 2582 class C1 {C1(this.x) { } int x;}'''); |
2713 addTestSource(''' | 2583 addTestSource(''' |
2714 import "/testA.dart"; | 2584 import "/testA.dart"; |
2715 int T2; | 2585 int T2; |
2716 F2() { } | 2586 F2() { } |
2717 typedef D2(); | 2587 typedef D2(); |
2718 class C2 { } | 2588 class C2 { } |
2719 /** */ ^ zoo(z) { } String name;'''); | 2589 /** */ ^ zoo(z) { } String name;'''); |
2720 await computeSuggestions(); | 2590 await computeSuggestions(); |
2721 | 2591 |
2722 expect(replacementOffset, completionOffset); | 2592 expect(replacementOffset, completionOffset); |
2723 expect(replacementLength, 0); | 2593 expect(replacementLength, 0); |
2724 assertNotSuggested('Object'); | 2594 assertNotSuggested('Object'); |
2725 assertNotSuggested('T1'); | 2595 assertNotSuggested('T1'); |
2726 assertNotSuggested('F1'); | 2596 assertNotSuggested('F1'); |
2727 assertNotSuggested('D1'); | 2597 assertNotSuggested('D1'); |
2728 assertNotSuggested('C1'); | 2598 assertNotSuggested('C1'); |
2729 assertNotSuggested('T2'); | 2599 assertNotSuggested('T2'); |
2730 assertNotSuggested('F2'); | 2600 assertNotSuggested('F2'); |
2731 assertSuggestFunctionTypeAlias('D2', null); | 2601 assertSuggestFunctionTypeAlias('D2', null); |
2732 assertSuggestClass('C2'); | 2602 assertSuggestClass('C2'); |
2733 assertNotSuggested('name'); | 2603 assertNotSuggested('name'); |
2734 } | 2604 } |
2735 | 2605 |
2736 test_FunctionDeclaration_returnType_afterComment3() async { | 2606 test_FunctionDeclaration_returnType_afterComment3() async { |
2737 // FunctionDeclaration ClassDeclaration CompilationUnit | 2607 // FunctionDeclaration ClassDeclaration CompilationUnit |
2738 addSource( | 2608 addSource('/testA.dart', ''' |
2739 '/testA.dart', | |
2740 ''' | |
2741 int T1; | 2609 int T1; |
2742 F1() { } | 2610 F1() { } |
2743 typedef D1(); | 2611 typedef D1(); |
2744 class C1 {C1(this.x) { } int x;}'''); | 2612 class C1 {C1(this.x) { } int x;}'''); |
2745 addTestSource(''' | 2613 addTestSource(''' |
2746 import "/testA.dart"; | 2614 import "/testA.dart"; |
2747 int T2; | 2615 int T2; |
2748 F2() { } | 2616 F2() { } |
2749 typedef D2(); | 2617 typedef D2(); |
2750 /// some dartdoc | 2618 /// some dartdoc |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2894 /// The [m^] | 2762 /// The [m^] |
2895 main(aaa, bbb) {}'''); | 2763 main(aaa, bbb) {}'''); |
2896 await computeSuggestions(); | 2764 await computeSuggestions(); |
2897 assertSuggestFunction('main', null, | 2765 assertSuggestFunction('main', null, |
2898 kind: CompletionSuggestionKind.IDENTIFIER, | 2766 kind: CompletionSuggestionKind.IDENTIFIER, |
2899 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 2767 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
2900 } | 2768 } |
2901 | 2769 |
2902 test_IndexExpression() async { | 2770 test_IndexExpression() async { |
2903 // ExpressionStatement Block | 2771 // ExpressionStatement Block |
2904 addSource( | 2772 addSource('/testA.dart', ''' |
2905 '/testA.dart', | |
2906 ''' | |
2907 int T1; | 2773 int T1; |
2908 F1() { } | 2774 F1() { } |
2909 class A {int x;}'''); | 2775 class A {int x;}'''); |
2910 addTestSource(''' | 2776 addTestSource(''' |
2911 import "/testA.dart"; | 2777 import "/testA.dart"; |
2912 int T2; | 2778 int T2; |
2913 F2() { } | 2779 F2() { } |
2914 class B {int x;} | 2780 class B {int x;} |
2915 class C {foo(){var f; {var x;} f[^]}}'''); | 2781 class C {foo(){var f; {var x;} f[^]}}'''); |
2916 await computeSuggestions(); | 2782 await computeSuggestions(); |
2917 | 2783 |
2918 assertNotSuggested('x'); | 2784 assertNotSuggested('x'); |
2919 assertSuggestLocalVariable('f', null); | 2785 assertSuggestLocalVariable('f', null); |
2920 assertSuggestMethod('foo', 'C', null, | 2786 assertSuggestMethod('foo', 'C', null, |
2921 relevance: DART_RELEVANCE_LOCAL_METHOD); | 2787 relevance: DART_RELEVANCE_LOCAL_METHOD); |
2922 assertSuggestClass('C'); | 2788 assertSuggestClass('C'); |
2923 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 2789 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
2924 assertSuggestTopLevelVar('T2', 'int', | 2790 assertSuggestTopLevelVar('T2', 'int', |
2925 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 2791 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
2926 assertNotSuggested('A'); | 2792 assertNotSuggested('A'); |
2927 assertNotSuggested('F1'); | 2793 assertNotSuggested('F1'); |
2928 // TODO (danrubel) getter is being suggested instead of top level var | 2794 // TODO (danrubel) getter is being suggested instead of top level var |
2929 //assertNotSuggested('T1'); | 2795 //assertNotSuggested('T1'); |
2930 } | 2796 } |
2931 | 2797 |
2932 test_IndexExpression2() async { | 2798 test_IndexExpression2() async { |
2933 // SimpleIdentifier IndexExpression ExpressionStatement Block | 2799 // SimpleIdentifier IndexExpression ExpressionStatement Block |
2934 addSource( | 2800 addSource('/testA.dart', ''' |
2935 '/testA.dart', | |
2936 ''' | |
2937 int T1; | 2801 int T1; |
2938 F1() { } | 2802 F1() { } |
2939 class A {int x;}'''); | 2803 class A {int x;}'''); |
2940 addTestSource(''' | 2804 addTestSource(''' |
2941 import "/testA.dart"; | 2805 import "/testA.dart"; |
2942 int T2; | 2806 int T2; |
2943 F2() { } | 2807 F2() { } |
2944 class B {int x;} | 2808 class B {int x;} |
2945 class C {foo(){var f; {var x;} f[T^]}}'''); | 2809 class C {foo(){var f; {var x;} f[T^]}}'''); |
2946 await computeSuggestions(); | 2810 await computeSuggestions(); |
(...skipping 11 matching lines...) Expand all Loading... |
2958 class B {B(this.x, [String boo]) { } int x;} | 2822 class B {B(this.x, [String boo]) { } int x;} |
2959 class C {C.bar({boo: 'hoo', int z: 0}) { } } | 2823 class C {C.bar({boo: 'hoo', int z: 0}) { } } |
2960 main() {new ^ String x = "hello";}'''); | 2824 main() {new ^ String x = "hello";}'''); |
2961 await computeSuggestions(); | 2825 await computeSuggestions(); |
2962 // Suggested by LocalConstructorContributor | 2826 // Suggested by LocalConstructorContributor |
2963 assertNoSuggestions(); | 2827 assertNoSuggestions(); |
2964 } | 2828 } |
2965 | 2829 |
2966 test_InstanceCreationExpression_imported() async { | 2830 test_InstanceCreationExpression_imported() async { |
2967 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression | 2831 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
2968 addSource( | 2832 addSource('/testA.dart', ''' |
2969 '/testA.dart', | |
2970 ''' | |
2971 int T1; | 2833 int T1; |
2972 F1() { } | 2834 F1() { } |
2973 class A {A(this.x) { } int x;}'''); | 2835 class A {A(this.x) { } int x;}'''); |
2974 addTestSource(''' | 2836 addTestSource(''' |
2975 import "/testA.dart"; | 2837 import "/testA.dart"; |
2976 import "dart:async"; | 2838 import "dart:async"; |
2977 int T2; | 2839 int T2; |
2978 F2() { } | 2840 F2() { } |
2979 class B {B(this.x, [String boo]) { } int x;} | 2841 class B {B(this.x, [String boo]) { } int x;} |
2980 class C {foo(){var f; {var x;} new ^}}'''); | 2842 class C {foo(){var f; {var x;} new ^}}'''); |
(...skipping 23 matching lines...) Expand all Loading... |
3004 await computeSuggestions(); | 2866 await computeSuggestions(); |
3005 | 2867 |
3006 expect(replacementOffset, completionOffset - 1); | 2868 expect(replacementOffset, completionOffset - 1); |
3007 expect(replacementLength, 1); | 2869 expect(replacementLength, 1); |
3008 assertNotSuggested('Future'); | 2870 assertNotSuggested('Future'); |
3009 assertNotSuggested('Foo'); | 2871 assertNotSuggested('Foo'); |
3010 } | 2872 } |
3011 | 2873 |
3012 test_InterpolationExpression() async { | 2874 test_InterpolationExpression() async { |
3013 // SimpleIdentifier InterpolationExpression StringInterpolation | 2875 // SimpleIdentifier InterpolationExpression StringInterpolation |
3014 addSource( | 2876 addSource('/testA.dart', ''' |
3015 '/testA.dart', | |
3016 ''' | |
3017 int T1; | 2877 int T1; |
3018 F1() { } | 2878 F1() { } |
3019 typedef D1(); | 2879 typedef D1(); |
3020 class C1 {C1(this.x) { } int x;}'''); | 2880 class C1 {C1(this.x) { } int x;}'''); |
3021 addTestSource(''' | 2881 addTestSource(''' |
3022 import "/testA.dart"; | 2882 import "/testA.dart"; |
3023 int T2; | 2883 int T2; |
3024 F2() { } | 2884 F2() { } |
3025 typedef D2(); | 2885 typedef D2(); |
3026 class C2 { } | 2886 class C2 { } |
(...skipping 10 matching lines...) Expand all Loading... |
3037 assertSuggestTopLevelVar('T2', 'int', | 2897 assertSuggestTopLevelVar('T2', 'int', |
3038 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 2898 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
3039 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 2899 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
3040 assertNotSuggested('D2'); | 2900 assertNotSuggested('D2'); |
3041 assertNotSuggested('C2'); | 2901 assertNotSuggested('C2'); |
3042 assertSuggestLocalVariable('name', 'String'); | 2902 assertSuggestLocalVariable('name', 'String'); |
3043 } | 2903 } |
3044 | 2904 |
3045 test_InterpolationExpression_block() async { | 2905 test_InterpolationExpression_block() async { |
3046 // SimpleIdentifier InterpolationExpression StringInterpolation | 2906 // SimpleIdentifier InterpolationExpression StringInterpolation |
3047 addSource( | 2907 addSource('/testA.dart', ''' |
3048 '/testA.dart', | |
3049 ''' | |
3050 int T1; | 2908 int T1; |
3051 F1() { } | 2909 F1() { } |
3052 typedef D1(); | 2910 typedef D1(); |
3053 class C1 {C1(this.x) { } int x;}'''); | 2911 class C1 {C1(this.x) { } int x;}'''); |
3054 addTestSource(''' | 2912 addTestSource(''' |
3055 import "/testA.dart"; | 2913 import "/testA.dart"; |
3056 int T2; | 2914 int T2; |
3057 F2() { } | 2915 F2() { } |
3058 typedef D2(); | 2916 typedef D2(); |
3059 class C2 { } | 2917 class C2 { } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 await computeSuggestions(); | 2970 await computeSuggestions(); |
3113 | 2971 |
3114 assertSuggestLocalVariable('name', 'String'); | 2972 assertSuggestLocalVariable('name', 'String'); |
3115 // top level results are partially filtered | 2973 // top level results are partially filtered |
3116 //assertNotSuggested('Object'); | 2974 //assertNotSuggested('Object'); |
3117 assertNotSuggested('length'); | 2975 assertNotSuggested('length'); |
3118 } | 2976 } |
3119 | 2977 |
3120 test_IsExpression() async { | 2978 test_IsExpression() async { |
3121 // SimpleIdentifier TypeName IsExpression IfStatement | 2979 // SimpleIdentifier TypeName IsExpression IfStatement |
3122 addSource( | 2980 addSource('/testB.dart', ''' |
3123 '/testB.dart', | |
3124 ''' | |
3125 lib B; | 2981 lib B; |
3126 foo() { } | 2982 foo() { } |
3127 class X {X.c(); X._d(); z() {}}'''); | 2983 class X {X.c(); X._d(); z() {}}'''); |
3128 addTestSource(''' | 2984 addTestSource(''' |
3129 import "/testB.dart"; | 2985 import "/testB.dart"; |
3130 class Y {Y.c(); Y._d(); z() {}} | 2986 class Y {Y.c(); Y._d(); z() {}} |
3131 main() {var x; if (x is ^) { }}'''); | 2987 main() {var x; if (x is ^) { }}'''); |
3132 await computeSuggestions(); | 2988 await computeSuggestions(); |
3133 | 2989 |
3134 expect(replacementOffset, completionOffset); | 2990 expect(replacementOffset, completionOffset); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 | 3085 |
3230 expect(replacementOffset, completionOffset - 3); | 3086 expect(replacementOffset, completionOffset - 3); |
3231 expect(replacementLength, 3); | 3087 expect(replacementLength, 3); |
3232 assertNotSuggested('a'); | 3088 assertNotSuggested('a'); |
3233 assertNotSuggested('main'); | 3089 assertNotSuggested('main'); |
3234 assertSuggestClass('A'); | 3090 assertSuggestClass('A'); |
3235 assertNotSuggested('Object'); | 3091 assertNotSuggested('Object'); |
3236 } | 3092 } |
3237 | 3093 |
3238 test_keyword() async { | 3094 test_keyword() async { |
3239 addSource( | 3095 addSource('/testB.dart', ''' |
3240 '/testB.dart', | |
3241 ''' | |
3242 lib B; | 3096 lib B; |
3243 int newT1; | 3097 int newT1; |
3244 int T1; | 3098 int T1; |
3245 nowIsIt() { } | 3099 nowIsIt() { } |
3246 class X {factory X.c(); factory X._d(); z() {}}'''); | 3100 class X {factory X.c(); factory X._d(); z() {}}'''); |
3247 addTestSource(''' | 3101 addTestSource(''' |
3248 import "/testB.dart"; | 3102 import "/testB.dart"; |
3249 String newer() {} | 3103 String newer() {} |
3250 var m; | 3104 var m; |
3251 main() {new^ X.c();}'''); | 3105 main() {new^ X.c();}'''); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3295 test_localVariableDeclarationName() async { | 3149 test_localVariableDeclarationName() async { |
3296 addTestSource('main() {String m^}'); | 3150 addTestSource('main() {String m^}'); |
3297 await computeSuggestions(); | 3151 await computeSuggestions(); |
3298 | 3152 |
3299 assertNotSuggested('main'); | 3153 assertNotSuggested('main'); |
3300 assertNotSuggested('min'); | 3154 assertNotSuggested('min'); |
3301 } | 3155 } |
3302 | 3156 |
3303 test_MapLiteralEntry() async { | 3157 test_MapLiteralEntry() async { |
3304 // MapLiteralEntry MapLiteral VariableDeclaration | 3158 // MapLiteralEntry MapLiteral VariableDeclaration |
3305 addSource( | 3159 addSource('/testA.dart', ''' |
3306 '/testA.dart', | |
3307 ''' | |
3308 int T1; | 3160 int T1; |
3309 F1() { } | 3161 F1() { } |
3310 typedef D1(); | 3162 typedef D1(); |
3311 class C1 {C1(this.x) { } int x;}'''); | 3163 class C1 {C1(this.x) { } int x;}'''); |
3312 addTestSource(''' | 3164 addTestSource(''' |
3313 import "/testA.dart"; | 3165 import "/testA.dart"; |
3314 int T2; | 3166 int T2; |
3315 F2() { } | 3167 F2() { } |
3316 typedef D2(); | 3168 typedef D2(); |
3317 class C2 { } | 3169 class C2 { } |
3318 foo = {^'''); | 3170 foo = {^'''); |
3319 await computeSuggestions(); | 3171 await computeSuggestions(); |
3320 | 3172 |
3321 expect(replacementOffset, completionOffset); | 3173 expect(replacementOffset, completionOffset); |
3322 expect(replacementLength, 0); | 3174 expect(replacementLength, 0); |
3323 assertNotSuggested('Object'); | 3175 assertNotSuggested('Object'); |
3324 assertNotSuggested('T1'); | 3176 assertNotSuggested('T1'); |
3325 assertNotSuggested('F1'); | 3177 assertNotSuggested('F1'); |
3326 assertNotSuggested('D1'); | 3178 assertNotSuggested('D1'); |
3327 assertNotSuggested('C1'); | 3179 assertNotSuggested('C1'); |
3328 assertSuggestTopLevelVar('T2', 'int', | 3180 assertSuggestTopLevelVar('T2', 'int', |
3329 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 3181 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
3330 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 3182 assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
3331 assertSuggestFunctionTypeAlias('D2', null); | 3183 assertSuggestFunctionTypeAlias('D2', null); |
3332 assertSuggestClass('C2'); | 3184 assertSuggestClass('C2'); |
3333 } | 3185 } |
3334 | 3186 |
3335 test_MapLiteralEntry1() async { | 3187 test_MapLiteralEntry1() async { |
3336 // MapLiteralEntry MapLiteral VariableDeclaration | 3188 // MapLiteralEntry MapLiteral VariableDeclaration |
3337 addSource( | 3189 addSource('/testA.dart', ''' |
3338 '/testA.dart', | |
3339 ''' | |
3340 int T1; | 3190 int T1; |
3341 F1() { } | 3191 F1() { } |
3342 typedef D1(); | 3192 typedef D1(); |
3343 class C1 {C1(this.x) { } int x;}'''); | 3193 class C1 {C1(this.x) { } int x;}'''); |
3344 addTestSource(''' | 3194 addTestSource(''' |
3345 import "/testA.dart"; | 3195 import "/testA.dart"; |
3346 int T2; | 3196 int T2; |
3347 F2() { } | 3197 F2() { } |
3348 typedef D2(); | 3198 typedef D2(); |
3349 class C2 { } | 3199 class C2 { } |
3350 foo = {T^'''); | 3200 foo = {T^'''); |
3351 await computeSuggestions(); | 3201 await computeSuggestions(); |
3352 | 3202 |
3353 expect(replacementOffset, completionOffset - 1); | 3203 expect(replacementOffset, completionOffset - 1); |
3354 expect(replacementLength, 1); | 3204 expect(replacementLength, 1); |
3355 assertNotSuggested('T1'); | 3205 assertNotSuggested('T1'); |
3356 assertSuggestTopLevelVar('T2', 'int', | 3206 assertSuggestTopLevelVar('T2', 'int', |
3357 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); | 3207 relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE); |
3358 } | 3208 } |
3359 | 3209 |
3360 test_MapLiteralEntry2() async { | 3210 test_MapLiteralEntry2() async { |
3361 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration | 3211 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration |
3362 addSource( | 3212 addSource('/testA.dart', ''' |
3363 '/testA.dart', | |
3364 ''' | |
3365 int T1; | 3213 int T1; |
3366 F1() { } | 3214 F1() { } |
3367 typedef D1(); | 3215 typedef D1(); |
3368 class C1 {C1(this.x) { } int x;}'''); | 3216 class C1 {C1(this.x) { } int x;}'''); |
3369 addTestSource(''' | 3217 addTestSource(''' |
3370 import "/testA.dart"; | 3218 import "/testA.dart"; |
3371 int T2; | 3219 int T2; |
3372 F2() { } | 3220 F2() { } |
3373 typedef D2(); | 3221 typedef D2(); |
3374 class C2 { } | 3222 class C2 { } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3482 CompletionSuggestion getterG = | 3330 CompletionSuggestion getterG = |
3483 assertSuggestGetter('_g', null, relevance: DART_RELEVANCE_DEFAULT); | 3331 assertSuggestGetter('_g', null, relevance: DART_RELEVANCE_DEFAULT); |
3484 if (getterG != null) { | 3332 if (getterG != null) { |
3485 expect(getterG.element.isDeprecated, isFalse); | 3333 expect(getterG.element.isDeprecated, isFalse); |
3486 expect(getterG.element.isPrivate, isTrue); | 3334 expect(getterG.element.isPrivate, isTrue); |
3487 } | 3335 } |
3488 } | 3336 } |
3489 | 3337 |
3490 test_MethodDeclaration_body_static() async { | 3338 test_MethodDeclaration_body_static() async { |
3491 // Block BlockFunctionBody MethodDeclaration | 3339 // Block BlockFunctionBody MethodDeclaration |
3492 addSource( | 3340 addSource('/testC.dart', ''' |
3493 '/testC.dart', | |
3494 ''' | |
3495 class C { | 3341 class C { |
3496 c1() {} | 3342 c1() {} |
3497 var c2; | 3343 var c2; |
3498 static c3() {} | 3344 static c3() {} |
3499 static var c4;}'''); | 3345 static var c4;}'''); |
3500 addTestSource(''' | 3346 addTestSource(''' |
3501 import "/testC.dart"; | 3347 import "/testC.dart"; |
3502 class B extends C { | 3348 class B extends C { |
3503 b1() {} | 3349 b1() {} |
3504 var b2; | 3350 var b2; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3625 assertSuggestFunction('bar', 'void', | 3471 assertSuggestFunction('bar', 'void', |
3626 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 3472 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
3627 assertSuggestMethod('a', 'A', 'Z', relevance: DART_RELEVANCE_LOCAL_METHOD); | 3473 assertSuggestMethod('a', 'A', 'Z', relevance: DART_RELEVANCE_LOCAL_METHOD); |
3628 assertSuggestParameter('x', 'X'); | 3474 assertSuggestParameter('x', 'X'); |
3629 assertSuggestParameter('y', 'int'); | 3475 assertSuggestParameter('y', 'int'); |
3630 assertNotSuggested('String'); | 3476 assertNotSuggested('String'); |
3631 } | 3477 } |
3632 | 3478 |
3633 test_MethodDeclaration_returnType() async { | 3479 test_MethodDeclaration_returnType() async { |
3634 // ClassDeclaration CompilationUnit | 3480 // ClassDeclaration CompilationUnit |
3635 addSource( | 3481 addSource('/testA.dart', ''' |
3636 '/testA.dart', | |
3637 ''' | |
3638 int T1; | 3482 int T1; |
3639 F1() { } | 3483 F1() { } |
3640 typedef D1(); | 3484 typedef D1(); |
3641 class C1 {C1(this.x) { } int x;}'''); | 3485 class C1 {C1(this.x) { } int x;}'''); |
3642 addTestSource(''' | 3486 addTestSource(''' |
3643 import "/testA.dart"; | 3487 import "/testA.dart"; |
3644 int T2; | 3488 int T2; |
3645 F2() { } | 3489 F2() { } |
3646 typedef D2(); | 3490 typedef D2(); |
3647 class C2 {^ zoo(z) { } String name; }'''); | 3491 class C2 {^ zoo(z) { } String name; }'''); |
3648 await computeSuggestions(); | 3492 await computeSuggestions(); |
3649 | 3493 |
3650 expect(replacementOffset, completionOffset); | 3494 expect(replacementOffset, completionOffset); |
3651 expect(replacementLength, 0); | 3495 expect(replacementLength, 0); |
3652 assertNotSuggested('Object'); | 3496 assertNotSuggested('Object'); |
3653 assertNotSuggested('T1'); | 3497 assertNotSuggested('T1'); |
3654 assertNotSuggested('F1'); | 3498 assertNotSuggested('F1'); |
3655 assertNotSuggested('D1'); | 3499 assertNotSuggested('D1'); |
3656 assertNotSuggested('C1'); | 3500 assertNotSuggested('C1'); |
3657 assertNotSuggested('T2'); | 3501 assertNotSuggested('T2'); |
3658 assertNotSuggested('F2'); | 3502 assertNotSuggested('F2'); |
3659 assertSuggestFunctionTypeAlias('D2', null); | 3503 assertSuggestFunctionTypeAlias('D2', null); |
3660 assertSuggestClass('C2'); | 3504 assertSuggestClass('C2'); |
3661 assertNotSuggested('name'); | 3505 assertNotSuggested('name'); |
3662 } | 3506 } |
3663 | 3507 |
3664 test_MethodDeclaration_returnType_afterComment() async { | 3508 test_MethodDeclaration_returnType_afterComment() async { |
3665 // ClassDeclaration CompilationUnit | 3509 // ClassDeclaration CompilationUnit |
3666 addSource( | 3510 addSource('/testA.dart', ''' |
3667 '/testA.dart', | |
3668 ''' | |
3669 int T1; | 3511 int T1; |
3670 F1() { } | 3512 F1() { } |
3671 typedef D1(); | 3513 typedef D1(); |
3672 class C1 {C1(this.x) { } int x;}'''); | 3514 class C1 {C1(this.x) { } int x;}'''); |
3673 addTestSource(''' | 3515 addTestSource(''' |
3674 import "/testA.dart"; | 3516 import "/testA.dart"; |
3675 int T2; | 3517 int T2; |
3676 F2() { } | 3518 F2() { } |
3677 typedef D2(); | 3519 typedef D2(); |
3678 class C2 {/* */ ^ zoo(z) { } String name; }'''); | 3520 class C2 {/* */ ^ zoo(z) { } String name; }'''); |
3679 await computeSuggestions(); | 3521 await computeSuggestions(); |
3680 | 3522 |
3681 expect(replacementOffset, completionOffset); | 3523 expect(replacementOffset, completionOffset); |
3682 expect(replacementLength, 0); | 3524 expect(replacementLength, 0); |
3683 assertNotSuggested('Object'); | 3525 assertNotSuggested('Object'); |
3684 assertNotSuggested('T1'); | 3526 assertNotSuggested('T1'); |
3685 assertNotSuggested('F1'); | 3527 assertNotSuggested('F1'); |
3686 assertNotSuggested('D1'); | 3528 assertNotSuggested('D1'); |
3687 assertNotSuggested('C1'); | 3529 assertNotSuggested('C1'); |
3688 assertNotSuggested('T2'); | 3530 assertNotSuggested('T2'); |
3689 assertNotSuggested('F2'); | 3531 assertNotSuggested('F2'); |
3690 assertSuggestFunctionTypeAlias('D2', null); | 3532 assertSuggestFunctionTypeAlias('D2', null); |
3691 assertSuggestClass('C2'); | 3533 assertSuggestClass('C2'); |
3692 assertNotSuggested('name'); | 3534 assertNotSuggested('name'); |
3693 } | 3535 } |
3694 | 3536 |
3695 test_MethodDeclaration_returnType_afterComment2() async { | 3537 test_MethodDeclaration_returnType_afterComment2() async { |
3696 // MethodDeclaration ClassDeclaration CompilationUnit | 3538 // MethodDeclaration ClassDeclaration CompilationUnit |
3697 addSource( | 3539 addSource('/testA.dart', ''' |
3698 '/testA.dart', | |
3699 ''' | |
3700 int T1; | 3540 int T1; |
3701 F1() { } | 3541 F1() { } |
3702 typedef D1(); | 3542 typedef D1(); |
3703 class C1 {C1(this.x) { } int x;}'''); | 3543 class C1 {C1(this.x) { } int x;}'''); |
3704 addTestSource(''' | 3544 addTestSource(''' |
3705 import "/testA.dart"; | 3545 import "/testA.dart"; |
3706 int T2; | 3546 int T2; |
3707 F2() { } | 3547 F2() { } |
3708 typedef D2(); | 3548 typedef D2(); |
3709 class C2 {/** */ ^ zoo(z) { } String name; }'''); | 3549 class C2 {/** */ ^ zoo(z) { } String name; }'''); |
3710 await computeSuggestions(); | 3550 await computeSuggestions(); |
3711 | 3551 |
3712 expect(replacementOffset, completionOffset); | 3552 expect(replacementOffset, completionOffset); |
3713 expect(replacementLength, 0); | 3553 expect(replacementLength, 0); |
3714 assertNotSuggested('Object'); | 3554 assertNotSuggested('Object'); |
3715 assertNotSuggested('T1'); | 3555 assertNotSuggested('T1'); |
3716 assertNotSuggested('F1'); | 3556 assertNotSuggested('F1'); |
3717 assertNotSuggested('D1'); | 3557 assertNotSuggested('D1'); |
3718 assertNotSuggested('C1'); | 3558 assertNotSuggested('C1'); |
3719 assertNotSuggested('T2'); | 3559 assertNotSuggested('T2'); |
3720 assertNotSuggested('F2'); | 3560 assertNotSuggested('F2'); |
3721 assertSuggestFunctionTypeAlias('D2', null); | 3561 assertSuggestFunctionTypeAlias('D2', null); |
3722 assertSuggestClass('C2'); | 3562 assertSuggestClass('C2'); |
3723 assertNotSuggested('name'); | 3563 assertNotSuggested('name'); |
3724 } | 3564 } |
3725 | 3565 |
3726 test_MethodDeclaration_returnType_afterComment3() async { | 3566 test_MethodDeclaration_returnType_afterComment3() async { |
3727 // MethodDeclaration ClassDeclaration CompilationUnit | 3567 // MethodDeclaration ClassDeclaration CompilationUnit |
3728 addSource( | 3568 addSource('/testA.dart', ''' |
3729 '/testA.dart', | |
3730 ''' | |
3731 int T1; | 3569 int T1; |
3732 F1() { } | 3570 F1() { } |
3733 typedef D1(); | 3571 typedef D1(); |
3734 class C1 {C1(this.x) { } int x;}'''); | 3572 class C1 {C1(this.x) { } int x;}'''); |
3735 addTestSource(''' | 3573 addTestSource(''' |
3736 import "/testA.dart"; | 3574 import "/testA.dart"; |
3737 int T2; | 3575 int T2; |
3738 F2() { } | 3576 F2() { } |
3739 typedef D2(); | 3577 typedef D2(); |
3740 class C2 { | 3578 class C2 { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3828 test_parameterName_excludeTypes() async { | 3666 test_parameterName_excludeTypes() async { |
3829 addTestSource('m(int ^) {}'); | 3667 addTestSource('m(int ^) {}'); |
3830 await computeSuggestions(); | 3668 await computeSuggestions(); |
3831 | 3669 |
3832 assertNotSuggested('int'); | 3670 assertNotSuggested('int'); |
3833 assertNotSuggested('bool'); | 3671 assertNotSuggested('bool'); |
3834 } | 3672 } |
3835 | 3673 |
3836 test_partFile_TypeName() async { | 3674 test_partFile_TypeName() async { |
3837 // SimpleIdentifier TypeName ConstructorName | 3675 // SimpleIdentifier TypeName ConstructorName |
3838 addSource( | 3676 addSource('/testB.dart', ''' |
3839 '/testB.dart', | |
3840 ''' | |
3841 lib B; | 3677 lib B; |
3842 int T1; | 3678 int T1; |
3843 F1() { } | 3679 F1() { } |
3844 class X {X.c(); X._d(); z() {}}'''); | 3680 class X {X.c(); X._d(); z() {}}'''); |
3845 addSource( | 3681 addSource('/testA.dart', ''' |
3846 '/testA.dart', | |
3847 ''' | |
3848 library libA; | 3682 library libA; |
3849 import "/testB.dart"; | 3683 import "/testB.dart"; |
3850 part "$testFile"; | 3684 part "$testFile"; |
3851 class A { } | 3685 class A { } |
3852 var m;'''); | 3686 var m;'''); |
3853 addTestSource(''' | 3687 addTestSource(''' |
3854 part of libA; | 3688 part of libA; |
3855 class B { factory B.bar(int x) => null; } | 3689 class B { factory B.bar(int x) => null; } |
3856 main() {new ^}'''); | 3690 main() {new ^}'''); |
3857 await computeSuggestions(); | 3691 await computeSuggestions(); |
3858 | 3692 |
3859 expect(replacementOffset, completionOffset); | 3693 expect(replacementOffset, completionOffset); |
3860 expect(replacementLength, 0); | 3694 expect(replacementLength, 0); |
3861 // Suggested by LocalConstructorContributor | 3695 // Suggested by LocalConstructorContributor |
3862 assertNotSuggested('B.bar'); | 3696 assertNotSuggested('B.bar'); |
3863 assertNotSuggested('Object'); | 3697 assertNotSuggested('Object'); |
3864 assertNotSuggested('X.c'); | 3698 assertNotSuggested('X.c'); |
3865 assertNotSuggested('X._d'); | 3699 assertNotSuggested('X._d'); |
3866 assertNotSuggested('A'); | 3700 assertNotSuggested('A'); |
3867 assertNotSuggested('F1'); | 3701 assertNotSuggested('F1'); |
3868 assertNotSuggested('T1'); | 3702 assertNotSuggested('T1'); |
3869 assertNotSuggested('_d'); | 3703 assertNotSuggested('_d'); |
3870 assertNotSuggested('z'); | 3704 assertNotSuggested('z'); |
3871 assertNotSuggested('m'); | 3705 assertNotSuggested('m'); |
3872 } | 3706 } |
3873 | 3707 |
3874 test_partFile_TypeName2() async { | 3708 test_partFile_TypeName2() async { |
3875 // SimpleIdentifier TypeName ConstructorName | 3709 // SimpleIdentifier TypeName ConstructorName |
3876 addSource( | 3710 addSource('/testB.dart', ''' |
3877 '/testB.dart', | |
3878 ''' | |
3879 lib B; | 3711 lib B; |
3880 int T1; | 3712 int T1; |
3881 F1() { } | 3713 F1() { } |
3882 class X {X.c(); X._d(); z() {}}'''); | 3714 class X {X.c(); X._d(); z() {}}'''); |
3883 addSource( | 3715 addSource('/testA.dart', ''' |
3884 '/testA.dart', | |
3885 ''' | |
3886 part of libA; | 3716 part of libA; |
3887 class B { }'''); | 3717 class B { }'''); |
3888 addTestSource(''' | 3718 addTestSource(''' |
3889 library libA; | 3719 library libA; |
3890 import "/testB.dart"; | 3720 import "/testB.dart"; |
3891 part "/testA.dart"; | 3721 part "/testA.dart"; |
3892 class A { A({String boo: 'hoo'}) { } } | 3722 class A { A({String boo: 'hoo'}) { } } |
3893 main() {new ^} | 3723 main() {new ^} |
3894 var m;'''); | 3724 var m;'''); |
3895 await computeLibrariesContaining(); | 3725 await computeLibrariesContaining(); |
3896 await computeSuggestions(); | 3726 await computeSuggestions(); |
3897 | 3727 |
3898 expect(replacementOffset, completionOffset); | 3728 expect(replacementOffset, completionOffset); |
3899 expect(replacementLength, 0); | 3729 expect(replacementLength, 0); |
3900 // Suggested by LocalConstructorContributor | 3730 // Suggested by LocalConstructorContributor |
3901 assertNotSuggested('A'); | 3731 assertNotSuggested('A'); |
3902 assertNotSuggested('Object'); | 3732 assertNotSuggested('Object'); |
3903 assertNotSuggested('X.c'); | 3733 assertNotSuggested('X.c'); |
3904 assertNotSuggested('X._d'); | 3734 assertNotSuggested('X._d'); |
3905 assertNotSuggested('B'); | 3735 assertNotSuggested('B'); |
3906 assertNotSuggested('F1'); | 3736 assertNotSuggested('F1'); |
3907 assertNotSuggested('T1'); | 3737 assertNotSuggested('T1'); |
3908 assertNotSuggested('_d'); | 3738 assertNotSuggested('_d'); |
3909 assertNotSuggested('z'); | 3739 assertNotSuggested('z'); |
3910 assertNotSuggested('m'); | 3740 assertNotSuggested('m'); |
3911 } | 3741 } |
3912 | 3742 |
3913 test_PrefixedIdentifier_class_const() async { | 3743 test_PrefixedIdentifier_class_const() async { |
3914 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block | 3744 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block |
3915 addSource( | 3745 addSource('/testB.dart', ''' |
3916 '/testB.dart', | |
3917 ''' | |
3918 lib B; | 3746 lib B; |
3919 class I { | 3747 class I { |
3920 static const scI = 'boo'; | 3748 static const scI = 'boo'; |
3921 X get f => new A(); | 3749 X get f => new A(); |
3922 get _g => new A();} | 3750 get _g => new A();} |
3923 class B implements I { | 3751 class B implements I { |
3924 static const int scB = 12; | 3752 static const int scB = 12; |
3925 var b; X _c; | 3753 var b; X _c; |
3926 X get d => new A();get _e => new A(); | 3754 X get d => new A();get _e => new A(); |
3927 set s1(I x) {} set _s2(I x) {} | 3755 set s1(I x) {} set _s2(I x) {} |
(...skipping 26 matching lines...) Expand all Loading... |
3954 assertNotSuggested('a'); | 3782 assertNotSuggested('a'); |
3955 assertNotSuggested('A'); | 3783 assertNotSuggested('A'); |
3956 assertNotSuggested('X'); | 3784 assertNotSuggested('X'); |
3957 assertNotSuggested('w'); | 3785 assertNotSuggested('w'); |
3958 assertNotSuggested('Object'); | 3786 assertNotSuggested('Object'); |
3959 assertNotSuggested('=='); | 3787 assertNotSuggested('=='); |
3960 } | 3788 } |
3961 | 3789 |
3962 test_PrefixedIdentifier_class_imported() async { | 3790 test_PrefixedIdentifier_class_imported() async { |
3963 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3791 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3964 addSource( | 3792 addSource('/testB.dart', ''' |
3965 '/testB.dart', | |
3966 ''' | |
3967 lib B; | 3793 lib B; |
3968 class I {X get f => new A();get _g => new A();} | 3794 class I {X get f => new A();get _g => new A();} |
3969 class A implements I { | 3795 class A implements I { |
3970 static const int sc = 12; | 3796 static const int sc = 12; |
3971 @deprecated var b; X _c; | 3797 @deprecated var b; X _c; |
3972 X get d => new A();get _e => new A(); | 3798 X get d => new A();get _e => new A(); |
3973 set s1(I x) {} set _s2(I x) {} | 3799 set s1(I x) {} set _s2(I x) {} |
3974 m(X x) {} I _n(X x) {}} | 3800 m(X x) {} I _n(X x) {}} |
3975 class X{}'''); | 3801 class X{}'''); |
3976 addTestSource(''' | 3802 addTestSource(''' |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4035 test_PrefixedIdentifier_getter() async { | 3861 test_PrefixedIdentifier_getter() async { |
4036 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3862 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
4037 addTestSource('String get g => "one"; f() {g.^}'); | 3863 addTestSource('String get g => "one"; f() {g.^}'); |
4038 await computeSuggestions(); | 3864 await computeSuggestions(); |
4039 | 3865 |
4040 assertNotSuggested('length'); | 3866 assertNotSuggested('length'); |
4041 } | 3867 } |
4042 | 3868 |
4043 test_PrefixedIdentifier_library() async { | 3869 test_PrefixedIdentifier_library() async { |
4044 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3870 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
4045 addSource( | 3871 addSource('/testB.dart', ''' |
4046 '/testB.dart', | |
4047 ''' | |
4048 lib B; | 3872 lib B; |
4049 var T1; | 3873 var T1; |
4050 class X { } | 3874 class X { } |
4051 class Y { }'''); | 3875 class Y { }'''); |
4052 addTestSource(''' | 3876 addTestSource(''' |
4053 import "/testB.dart" as b; | 3877 import "/testB.dart" as b; |
4054 var T2; | 3878 var T2; |
4055 class A { } | 3879 class A { } |
4056 main() {b.^}'''); | 3880 main() {b.^}'''); |
4057 await computeSuggestions(); | 3881 await computeSuggestions(); |
4058 | 3882 |
4059 expect(replacementOffset, completionOffset); | 3883 expect(replacementOffset, completionOffset); |
4060 expect(replacementLength, 0); | 3884 expect(replacementLength, 0); |
4061 // Suggested by LibraryMemberContributor | 3885 // Suggested by LibraryMemberContributor |
4062 assertNotSuggested('X'); | 3886 assertNotSuggested('X'); |
4063 assertNotSuggested('Y'); | 3887 assertNotSuggested('Y'); |
4064 assertNotSuggested('T1'); | 3888 assertNotSuggested('T1'); |
4065 assertNotSuggested('T2'); | 3889 assertNotSuggested('T2'); |
4066 assertNotSuggested('Object'); | 3890 assertNotSuggested('Object'); |
4067 assertNotSuggested('b'); | 3891 assertNotSuggested('b'); |
4068 assertNotSuggested('A'); | 3892 assertNotSuggested('A'); |
4069 assertNotSuggested('=='); | 3893 assertNotSuggested('=='); |
4070 } | 3894 } |
4071 | 3895 |
4072 test_PrefixedIdentifier_library_typesOnly() async { | 3896 test_PrefixedIdentifier_library_typesOnly() async { |
4073 // SimpleIdentifier PrefixedIdentifier TypeName | 3897 // SimpleIdentifier PrefixedIdentifier TypeName |
4074 addSource( | 3898 addSource('/testB.dart', ''' |
4075 '/testB.dart', | |
4076 ''' | |
4077 lib B; | 3899 lib B; |
4078 var T1; | 3900 var T1; |
4079 class X { } | 3901 class X { } |
4080 class Y { }'''); | 3902 class Y { }'''); |
4081 addTestSource(''' | 3903 addTestSource(''' |
4082 import "/testB.dart" as b; | 3904 import "/testB.dart" as b; |
4083 var T2; | 3905 var T2; |
4084 class A { } | 3906 class A { } |
4085 foo(b.^ f) {}'''); | 3907 foo(b.^ f) {}'''); |
4086 await computeSuggestions(); | 3908 await computeSuggestions(); |
4087 | 3909 |
4088 expect(replacementOffset, completionOffset); | 3910 expect(replacementOffset, completionOffset); |
4089 expect(replacementLength, 0); | 3911 expect(replacementLength, 0); |
4090 // Suggested by LibraryMemberContributor | 3912 // Suggested by LibraryMemberContributor |
4091 assertNotSuggested('X'); | 3913 assertNotSuggested('X'); |
4092 assertNotSuggested('Y'); | 3914 assertNotSuggested('Y'); |
4093 assertNotSuggested('T1'); | 3915 assertNotSuggested('T1'); |
4094 assertNotSuggested('T2'); | 3916 assertNotSuggested('T2'); |
4095 assertNotSuggested('Object'); | 3917 assertNotSuggested('Object'); |
4096 assertNotSuggested('b'); | 3918 assertNotSuggested('b'); |
4097 assertNotSuggested('A'); | 3919 assertNotSuggested('A'); |
4098 assertNotSuggested('=='); | 3920 assertNotSuggested('=='); |
4099 } | 3921 } |
4100 | 3922 |
4101 test_PrefixedIdentifier_library_typesOnly2() async { | 3923 test_PrefixedIdentifier_library_typesOnly2() async { |
4102 // SimpleIdentifier PrefixedIdentifier TypeName | 3924 // SimpleIdentifier PrefixedIdentifier TypeName |
4103 addSource( | 3925 addSource('/testB.dart', ''' |
4104 '/testB.dart', | |
4105 ''' | |
4106 lib B; | 3926 lib B; |
4107 var T1; | 3927 var T1; |
4108 class X { } | 3928 class X { } |
4109 class Y { }'''); | 3929 class Y { }'''); |
4110 addTestSource(''' | 3930 addTestSource(''' |
4111 import "/testB.dart" as b; | 3931 import "/testB.dart" as b; |
4112 var T2; | 3932 var T2; |
4113 class A { } | 3933 class A { } |
4114 foo(b.^) {}'''); | 3934 foo(b.^) {}'''); |
4115 await computeSuggestions(); | 3935 await computeSuggestions(); |
4116 | 3936 |
4117 expect(replacementOffset, completionOffset); | 3937 expect(replacementOffset, completionOffset); |
4118 expect(replacementLength, 0); | 3938 expect(replacementLength, 0); |
4119 // Suggested by LibraryMemberContributor | 3939 // Suggested by LibraryMemberContributor |
4120 assertNotSuggested('X'); | 3940 assertNotSuggested('X'); |
4121 assertNotSuggested('Y'); | 3941 assertNotSuggested('Y'); |
4122 assertNotSuggested('T1'); | 3942 assertNotSuggested('T1'); |
4123 assertNotSuggested('T2'); | 3943 assertNotSuggested('T2'); |
4124 assertNotSuggested('Object'); | 3944 assertNotSuggested('Object'); |
4125 assertNotSuggested('b'); | 3945 assertNotSuggested('b'); |
4126 assertNotSuggested('A'); | 3946 assertNotSuggested('A'); |
4127 assertNotSuggested('=='); | 3947 assertNotSuggested('=='); |
4128 } | 3948 } |
4129 | 3949 |
4130 test_PrefixedIdentifier_parameter() async { | 3950 test_PrefixedIdentifier_parameter() async { |
4131 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3951 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
4132 addSource( | 3952 addSource('/testB.dart', ''' |
4133 '/testB.dart', | |
4134 ''' | |
4135 lib B; | 3953 lib B; |
4136 class _W {M y; var _z;} | 3954 class _W {M y; var _z;} |
4137 class X extends _W {} | 3955 class X extends _W {} |
4138 class M{}'''); | 3956 class M{}'''); |
4139 addTestSource(''' | 3957 addTestSource(''' |
4140 import "/testB.dart"; | 3958 import "/testB.dart"; |
4141 foo(X x) {x.^}'''); | 3959 foo(X x) {x.^}'''); |
4142 await computeSuggestions(); | 3960 await computeSuggestions(); |
4143 | 3961 |
4144 expect(replacementOffset, completionOffset); | 3962 expect(replacementOffset, completionOffset); |
4145 expect(replacementLength, 0); | 3963 expect(replacementLength, 0); |
4146 assertNotSuggested('y'); | 3964 assertNotSuggested('y'); |
4147 assertNotSuggested('_z'); | 3965 assertNotSuggested('_z'); |
4148 assertNotSuggested('=='); | 3966 assertNotSuggested('=='); |
4149 } | 3967 } |
4150 | 3968 |
4151 test_PrefixedIdentifier_prefix() async { | 3969 test_PrefixedIdentifier_prefix() async { |
4152 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3970 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
4153 addSource( | 3971 addSource('/testA.dart', ''' |
4154 '/testA.dart', | |
4155 ''' | |
4156 class A {static int bar = 10;} | 3972 class A {static int bar = 10;} |
4157 _B() {}'''); | 3973 _B() {}'''); |
4158 addTestSource(''' | 3974 addTestSource(''' |
4159 import "/testA.dart"; | 3975 import "/testA.dart"; |
4160 class X {foo(){A^.bar}}'''); | 3976 class X {foo(){A^.bar}}'''); |
4161 await computeSuggestions(); | 3977 await computeSuggestions(); |
4162 | 3978 |
4163 expect(replacementOffset, completionOffset - 1); | 3979 expect(replacementOffset, completionOffset - 1); |
4164 expect(replacementLength, 1); | 3980 expect(replacementLength, 1); |
4165 assertNotSuggested('A'); | 3981 assertNotSuggested('A'); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4630 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 4446 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4631 // TopLevelVariableDeclaration | 4447 // TopLevelVariableDeclaration |
4632 addTestSource('class A {} var ^'); | 4448 addTestSource('class A {} var ^'); |
4633 await computeSuggestions(); | 4449 await computeSuggestions(); |
4634 | 4450 |
4635 assertNoSuggestions(); | 4451 assertNoSuggestions(); |
4636 } | 4452 } |
4637 | 4453 |
4638 test_TypeArgumentList() async { | 4454 test_TypeArgumentList() async { |
4639 // SimpleIdentifier BinaryExpression ExpressionStatement | 4455 // SimpleIdentifier BinaryExpression ExpressionStatement |
4640 addSource( | 4456 addSource('/testA.dart', ''' |
4641 '/testA.dart', | |
4642 ''' | |
4643 class C1 {int x;} | 4457 class C1 {int x;} |
4644 F1() => 0; | 4458 F1() => 0; |
4645 typedef String T1(int blat);'''); | 4459 typedef String T1(int blat);'''); |
4646 addTestSource(''' | 4460 addTestSource(''' |
4647 import "/testA.dart";' | 4461 import "/testA.dart";' |
4648 class C2 {int x;} | 4462 class C2 {int x;} |
4649 F2() => 0; | 4463 F2() => 0; |
4650 typedef int T2(int blat); | 4464 typedef int T2(int blat); |
4651 class C<E> {} | 4465 class C<E> {} |
4652 main() { C<^> c; }'''); | 4466 main() { C<^> c; }'''); |
4653 await computeSuggestions(); | 4467 await computeSuggestions(); |
4654 | 4468 |
4655 expect(replacementOffset, completionOffset); | 4469 expect(replacementOffset, completionOffset); |
4656 expect(replacementLength, 0); | 4470 expect(replacementLength, 0); |
4657 assertNotSuggested('Object'); | 4471 assertNotSuggested('Object'); |
4658 assertNotSuggested('C1'); | 4472 assertNotSuggested('C1'); |
4659 assertNotSuggested('T1'); | 4473 assertNotSuggested('T1'); |
4660 assertSuggestClass('C2'); | 4474 assertSuggestClass('C2'); |
4661 assertSuggestFunctionTypeAlias('T2', 'int'); | 4475 assertSuggestFunctionTypeAlias('T2', 'int'); |
4662 assertNotSuggested('F1'); | 4476 assertNotSuggested('F1'); |
4663 assertNotSuggested('F2'); | 4477 assertNotSuggested('F2'); |
4664 } | 4478 } |
4665 | 4479 |
4666 test_TypeArgumentList2() async { | 4480 test_TypeArgumentList2() async { |
4667 // TypeName TypeArgumentList TypeName | 4481 // TypeName TypeArgumentList TypeName |
4668 addSource( | 4482 addSource('/testA.dart', ''' |
4669 '/testA.dart', | |
4670 ''' | |
4671 class C1 {int x;} | 4483 class C1 {int x;} |
4672 F1() => 0; | 4484 F1() => 0; |
4673 typedef String T1(int blat);'''); | 4485 typedef String T1(int blat);'''); |
4674 addTestSource(''' | 4486 addTestSource(''' |
4675 import "/testA.dart";' | 4487 import "/testA.dart";' |
4676 class C2 {int x;} | 4488 class C2 {int x;} |
4677 F2() => 0; | 4489 F2() => 0; |
4678 typedef int T2(int blat); | 4490 typedef int T2(int blat); |
4679 class C<E> {} | 4491 class C<E> {} |
4680 main() { C<C^> c; }'''); | 4492 main() { C<C^> c; }'''); |
4681 await computeSuggestions(); | 4493 await computeSuggestions(); |
4682 | 4494 |
4683 expect(replacementOffset, completionOffset - 1); | 4495 expect(replacementOffset, completionOffset - 1); |
4684 expect(replacementLength, 1); | 4496 expect(replacementLength, 1); |
4685 assertNotSuggested('C1'); | 4497 assertNotSuggested('C1'); |
4686 assertSuggestClass('C2'); | 4498 assertSuggestClass('C2'); |
4687 } | 4499 } |
4688 | 4500 |
4689 test_VariableDeclaration_name() async { | 4501 test_VariableDeclaration_name() async { |
4690 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 4502 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4691 // VariableDeclarationStatement Block | 4503 // VariableDeclarationStatement Block |
4692 addSource( | 4504 addSource('/testB.dart', ''' |
4693 '/testB.dart', | |
4694 ''' | |
4695 lib B; | 4505 lib B; |
4696 foo() { } | 4506 foo() { } |
4697 class _B { } | 4507 class _B { } |
4698 class X {X.c(); X._d(); z() {}}'''); | 4508 class X {X.c(); X._d(); z() {}}'''); |
4699 addTestSource(''' | 4509 addTestSource(''' |
4700 import "/testB.dart"; | 4510 import "/testB.dart"; |
4701 class Y {Y.c(); Y._d(); z() {}} | 4511 class Y {Y.c(); Y._d(); z() {}} |
4702 main() {var ^}'''); | 4512 main() {var ^}'''); |
4703 await computeSuggestions(); | 4513 await computeSuggestions(); |
4704 | 4514 |
4705 assertNoSuggestions(); | 4515 assertNoSuggestions(); |
4706 } | 4516 } |
4707 | 4517 |
4708 test_VariableDeclarationList_final() async { | 4518 test_VariableDeclarationList_final() async { |
4709 // VariableDeclarationList VariableDeclarationStatement Block | 4519 // VariableDeclarationList VariableDeclarationStatement Block |
4710 addTestSource('main() {final ^} class C { }'); | 4520 addTestSource('main() {final ^} class C { }'); |
4711 await computeSuggestions(); | 4521 await computeSuggestions(); |
4712 | 4522 |
4713 assertNotSuggested('Object'); | 4523 assertNotSuggested('Object'); |
4714 assertSuggestClass('C'); | 4524 assertSuggestClass('C'); |
4715 assertNotSuggested('=='); | 4525 assertNotSuggested('=='); |
4716 } | 4526 } |
4717 | 4527 |
4718 test_VariableDeclarationStatement_RHS() async { | 4528 test_VariableDeclarationStatement_RHS() async { |
4719 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 4529 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4720 // VariableDeclarationStatement | 4530 // VariableDeclarationStatement |
4721 addSource( | 4531 addSource('/testB.dart', ''' |
4722 '/testB.dart', | |
4723 ''' | |
4724 lib B; | 4532 lib B; |
4725 foo() { } | 4533 foo() { } |
4726 class _B { } | 4534 class _B { } |
4727 class X {X.c(); X._d(); z() {}}'''); | 4535 class X {X.c(); X._d(); z() {}}'''); |
4728 addTestSource(''' | 4536 addTestSource(''' |
4729 import "/testB.dart"; | 4537 import "/testB.dart"; |
4730 class Y {Y.c(); Y._d(); z() {}} | 4538 class Y {Y.c(); Y._d(); z() {}} |
4731 class C {bar(){var f; {var x;} var e = ^}}'''); | 4539 class C {bar(){var f; {var x;} var e = ^}}'''); |
4732 await computeSuggestions(); | 4540 await computeSuggestions(); |
4733 | 4541 |
4734 expect(replacementOffset, completionOffset); | 4542 expect(replacementOffset, completionOffset); |
4735 expect(replacementLength, 0); | 4543 expect(replacementLength, 0); |
4736 assertNotSuggested('X'); | 4544 assertNotSuggested('X'); |
4737 assertNotSuggested('_B'); | 4545 assertNotSuggested('_B'); |
4738 assertSuggestClass('Y'); | 4546 assertSuggestClass('Y'); |
4739 assertSuggestClass('C'); | 4547 assertSuggestClass('C'); |
4740 assertSuggestLocalVariable('f', null); | 4548 assertSuggestLocalVariable('f', null); |
4741 assertNotSuggested('x'); | 4549 assertNotSuggested('x'); |
4742 assertNotSuggested('e'); | 4550 assertNotSuggested('e'); |
4743 } | 4551 } |
4744 | 4552 |
4745 test_VariableDeclarationStatement_RHS_missing_semicolon() async { | 4553 test_VariableDeclarationStatement_RHS_missing_semicolon() async { |
4746 // VariableDeclaration VariableDeclarationList | 4554 // VariableDeclaration VariableDeclarationList |
4747 // VariableDeclarationStatement | 4555 // VariableDeclarationStatement |
4748 addSource( | 4556 addSource('/testB.dart', ''' |
4749 '/testB.dart', | |
4750 ''' | |
4751 lib B; | 4557 lib B; |
4752 foo1() { } | 4558 foo1() { } |
4753 void bar1() { } | 4559 void bar1() { } |
4754 class _B { } | 4560 class _B { } |
4755 class X {X.c(); X._d(); z() {}}'''); | 4561 class X {X.c(); X._d(); z() {}}'''); |
4756 addTestSource(''' | 4562 addTestSource(''' |
4757 import "/testB.dart"; | 4563 import "/testB.dart"; |
4758 foo2() { } | 4564 foo2() { } |
4759 void bar2() { } | 4565 void bar2() { } |
4760 class Y {Y.c(); Y._d(); z() {}} | 4566 class Y {Y.c(); Y._d(); z() {}} |
4761 class C {bar(){var f; {var x;} var e = ^ var g}}'''); | 4567 class C {bar(){var f; {var x;} var e = ^ var g}}'''); |
4762 await computeSuggestions(); | 4568 await computeSuggestions(); |
4763 | 4569 |
4764 expect(replacementOffset, completionOffset); | 4570 expect(replacementOffset, completionOffset); |
4765 expect(replacementLength, 0); | 4571 expect(replacementLength, 0); |
4766 assertNotSuggested('X'); | 4572 assertNotSuggested('X'); |
4767 assertNotSuggested('foo1'); | 4573 assertNotSuggested('foo1'); |
4768 assertNotSuggested('bar1'); | 4574 assertNotSuggested('bar1'); |
4769 assertSuggestFunction('foo2', null, | 4575 assertSuggestFunction('foo2', null, |
4770 relevance: DART_RELEVANCE_LOCAL_FUNCTION); | 4576 relevance: DART_RELEVANCE_LOCAL_FUNCTION); |
4771 assertNotSuggested('bar2'); | 4577 assertNotSuggested('bar2'); |
4772 assertNotSuggested('_B'); | 4578 assertNotSuggested('_B'); |
4773 assertSuggestClass('Y'); | 4579 assertSuggestClass('Y'); |
4774 assertSuggestClass('C'); | 4580 assertSuggestClass('C'); |
4775 assertSuggestLocalVariable('f', null); | 4581 assertSuggestLocalVariable('f', null); |
4776 assertNotSuggested('x'); | 4582 assertNotSuggested('x'); |
4777 assertNotSuggested('e'); | 4583 assertNotSuggested('e'); |
4778 } | 4584 } |
4779 } | 4585 } |
OLD | NEW |