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_constructor_c
ontributor.dart'; | 7 import 'package:analysis_server/src/services/completion/dart/local_constructor_c
ontributor.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 new A^ | 67 new A^ |
68 } | 68 } |
69 }'''); | 69 }'''); |
70 await computeSuggestions(); | 70 await computeSuggestions(); |
71 | 71 |
72 assertSuggestConstructor('A', defaultArgListString: 'bar, baz: null'); | 72 assertSuggestConstructor('A', defaultArgListString: 'bar, baz: null'); |
73 } | 73 } |
74 | 74 |
75 test_ArgumentList() async { | 75 test_ArgumentList() async { |
76 // ArgumentList MethodInvocation ExpressionStatement Block | 76 // ArgumentList MethodInvocation ExpressionStatement Block |
77 addSource( | 77 addSource('/libA.dart', ''' |
78 '/libA.dart', | |
79 ''' | |
80 library A; | 78 library A; |
81 bool hasLength(int expected) { } | 79 bool hasLength(int expected) { } |
82 void baz() { }'''); | 80 void baz() { }'''); |
83 addTestSource(''' | 81 addTestSource(''' |
84 import '/libA.dart'; | 82 import '/libA.dart'; |
85 class B { } | 83 class B { } |
86 String bar() => true; | 84 String bar() => true; |
87 void main() {expect(^)}'''); | 85 void main() {expect(^)}'''); |
88 await computeSuggestions(); | 86 await computeSuggestions(); |
89 | 87 |
90 expect(replacementOffset, completionOffset); | 88 expect(replacementOffset, completionOffset); |
91 expect(replacementLength, 0); | 89 expect(replacementLength, 0); |
92 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 90 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
93 assertNotSuggested('bar'); | 91 assertNotSuggested('bar'); |
94 assertNotSuggested('hasLength'); | 92 assertNotSuggested('hasLength'); |
95 assertNotSuggested('identical'); | 93 assertNotSuggested('identical'); |
96 assertNotSuggested('B'); | 94 assertNotSuggested('B'); |
97 assertNotSuggested('Object'); | 95 assertNotSuggested('Object'); |
98 assertNotSuggested('main'); | 96 assertNotSuggested('main'); |
99 assertNotSuggested('baz'); | 97 assertNotSuggested('baz'); |
100 assertNotSuggested('print'); | 98 assertNotSuggested('print'); |
101 } | 99 } |
102 | 100 |
103 test_ArgumentList_imported_function() async { | 101 test_ArgumentList_imported_function() async { |
104 // ArgumentList MethodInvocation ExpressionStatement Block | 102 // ArgumentList MethodInvocation ExpressionStatement Block |
105 addSource( | 103 addSource('/libA.dart', ''' |
106 '/libA.dart', | |
107 ''' | |
108 library A; | 104 library A; |
109 bool hasLength(int expected) { } | 105 bool hasLength(int expected) { } |
110 expect(arg) { } | 106 expect(arg) { } |
111 void baz() { }'''); | 107 void baz() { }'''); |
112 addTestSource(''' | 108 addTestSource(''' |
113 import '/libA.dart' | 109 import '/libA.dart' |
114 class B { } | 110 class B { } |
115 String bar() => true; | 111 String bar() => true; |
116 void main() {expect(^)}'''); | 112 void main() {expect(^)}'''); |
117 await computeSuggestions(); | 113 await computeSuggestions(); |
118 | 114 |
119 expect(replacementOffset, completionOffset); | 115 expect(replacementOffset, completionOffset); |
120 expect(replacementLength, 0); | 116 expect(replacementLength, 0); |
121 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 117 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
122 assertNotSuggested('bar'); | 118 assertNotSuggested('bar'); |
123 assertNotSuggested('hasLength'); | 119 assertNotSuggested('hasLength'); |
124 assertNotSuggested('identical'); | 120 assertNotSuggested('identical'); |
125 assertNotSuggested('B'); | 121 assertNotSuggested('B'); |
126 assertNotSuggested('Object'); | 122 assertNotSuggested('Object'); |
127 assertNotSuggested('main'); | 123 assertNotSuggested('main'); |
128 assertNotSuggested('baz'); | 124 assertNotSuggested('baz'); |
129 assertNotSuggested('print'); | 125 assertNotSuggested('print'); |
130 } | 126 } |
131 | 127 |
132 test_ArgumentList_InstanceCreationExpression_functionalArg() async { | 128 test_ArgumentList_InstanceCreationExpression_functionalArg() async { |
133 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 129 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
134 addSource( | 130 addSource('/libA.dart', ''' |
135 '/libA.dart', | |
136 ''' | |
137 library A; | 131 library A; |
138 class A { A(f()) { } } | 132 class A { A(f()) { } } |
139 bool hasLength(int expected) { } | 133 bool hasLength(int expected) { } |
140 void baz() { }'''); | 134 void baz() { }'''); |
141 addTestSource(''' | 135 addTestSource(''' |
142 import 'dart:async'; | 136 import 'dart:async'; |
143 import '/libA.dart'; | 137 import '/libA.dart'; |
144 class B { } | 138 class B { } |
145 String bar() => true; | 139 String bar() => true; |
146 void main() {new A(^)}'''); | 140 void main() {new A(^)}'''); |
147 await computeSuggestions(); | 141 await computeSuggestions(); |
148 | 142 |
149 expect(replacementOffset, completionOffset); | 143 expect(replacementOffset, completionOffset); |
150 expect(replacementLength, 0); | 144 expect(replacementLength, 0); |
151 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 145 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
152 assertNotSuggested('bar'); | 146 assertNotSuggested('bar'); |
153 assertNotSuggested('hasLength'); | 147 assertNotSuggested('hasLength'); |
154 assertNotSuggested('identical'); | 148 assertNotSuggested('identical'); |
155 assertNotSuggested('B'); | 149 assertNotSuggested('B'); |
156 assertNotSuggested('A'); | 150 assertNotSuggested('A'); |
157 assertNotSuggested('Object'); | 151 assertNotSuggested('Object'); |
158 assertNotSuggested('main'); | 152 assertNotSuggested('main'); |
159 assertNotSuggested('baz'); | 153 assertNotSuggested('baz'); |
160 assertNotSuggested('print'); | 154 assertNotSuggested('print'); |
161 } | 155 } |
162 | 156 |
163 test_ArgumentList_InstanceCreationExpression_typedefArg() async { | 157 test_ArgumentList_InstanceCreationExpression_typedefArg() async { |
164 // ArgumentList InstanceCreationExpression ExpressionStatement Block | 158 // ArgumentList InstanceCreationExpression ExpressionStatement Block |
165 addSource( | 159 addSource('/libA.dart', ''' |
166 '/libA.dart', | |
167 ''' | |
168 library A; | 160 library A; |
169 typedef Funct(); | 161 typedef Funct(); |
170 class A { A(Funct f) { } } | 162 class A { A(Funct f) { } } |
171 bool hasLength(int expected) { } | 163 bool hasLength(int expected) { } |
172 void baz() { }'''); | 164 void baz() { }'''); |
173 addTestSource(''' | 165 addTestSource(''' |
174 import 'dart:async'; | 166 import 'dart:async'; |
175 import '/libA.dart'; | 167 import '/libA.dart'; |
176 class B { } | 168 class B { } |
177 String bar() => true; | 169 String bar() => true; |
178 void main() {new A(^)}'''); | 170 void main() {new A(^)}'''); |
179 await computeSuggestions(); | 171 await computeSuggestions(); |
180 | 172 |
181 expect(replacementOffset, completionOffset); | 173 expect(replacementOffset, completionOffset); |
182 expect(replacementLength, 0); | 174 expect(replacementLength, 0); |
183 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 175 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
184 assertNotSuggested('bar'); | 176 assertNotSuggested('bar'); |
185 assertNotSuggested('hasLength'); | 177 assertNotSuggested('hasLength'); |
186 assertNotSuggested('identical'); | 178 assertNotSuggested('identical'); |
187 assertNotSuggested('B'); | 179 assertNotSuggested('B'); |
188 assertNotSuggested('A'); | 180 assertNotSuggested('A'); |
189 assertNotSuggested('Object'); | 181 assertNotSuggested('Object'); |
190 assertNotSuggested('main'); | 182 assertNotSuggested('main'); |
191 assertNotSuggested('baz'); | 183 assertNotSuggested('baz'); |
192 assertNotSuggested('print'); | 184 assertNotSuggested('print'); |
193 } | 185 } |
194 | 186 |
195 test_ArgumentList_local_function() async { | 187 test_ArgumentList_local_function() async { |
196 // ArgumentList MethodInvocation ExpressionStatement Block | 188 // ArgumentList MethodInvocation ExpressionStatement Block |
197 addSource( | 189 addSource('/libA.dart', ''' |
198 '/libA.dart', | |
199 ''' | |
200 library A; | 190 library A; |
201 bool hasLength(int expected) { } | 191 bool hasLength(int expected) { } |
202 void baz() { }'''); | 192 void baz() { }'''); |
203 addTestSource(''' | 193 addTestSource(''' |
204 import '/libA.dart' | 194 import '/libA.dart' |
205 expect(arg) { } | 195 expect(arg) { } |
206 class B { } | 196 class B { } |
207 String bar() => true; | 197 String bar() => true; |
208 void main() {expect(^)}'''); | 198 void main() {expect(^)}'''); |
209 await computeSuggestions(); | 199 await computeSuggestions(); |
210 | 200 |
211 expect(replacementOffset, completionOffset); | 201 expect(replacementOffset, completionOffset); |
212 expect(replacementLength, 0); | 202 expect(replacementLength, 0); |
213 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 203 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
214 assertNotSuggested('bar'); | 204 assertNotSuggested('bar'); |
215 assertNotSuggested('hasLength'); | 205 assertNotSuggested('hasLength'); |
216 assertNotSuggested('identical'); | 206 assertNotSuggested('identical'); |
217 assertNotSuggested('B'); | 207 assertNotSuggested('B'); |
218 assertNotSuggested('Object'); | 208 assertNotSuggested('Object'); |
219 assertNotSuggested('main'); | 209 assertNotSuggested('main'); |
220 assertNotSuggested('baz'); | 210 assertNotSuggested('baz'); |
221 assertNotSuggested('print'); | 211 assertNotSuggested('print'); |
222 } | 212 } |
223 | 213 |
224 test_ArgumentList_local_method() async { | 214 test_ArgumentList_local_method() async { |
225 // ArgumentList MethodInvocation ExpressionStatement Block | 215 // ArgumentList MethodInvocation ExpressionStatement Block |
226 addSource( | 216 addSource('/libA.dart', ''' |
227 '/libA.dart', | |
228 ''' | |
229 library A; | 217 library A; |
230 bool hasLength(int expected) { } | 218 bool hasLength(int expected) { } |
231 void baz() { }'''); | 219 void baz() { }'''); |
232 addTestSource(''' | 220 addTestSource(''' |
233 import '/libA.dart' | 221 import '/libA.dart' |
234 class B { | 222 class B { |
235 expect(arg) { } | 223 expect(arg) { } |
236 void foo() {expect(^)}} | 224 void foo() {expect(^)}} |
237 String bar() => true;'''); | 225 String bar() => true;'''); |
238 await computeSuggestions(); | 226 await computeSuggestions(); |
239 | 227 |
240 expect(replacementOffset, completionOffset); | 228 expect(replacementOffset, completionOffset); |
241 expect(replacementLength, 0); | 229 expect(replacementLength, 0); |
242 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 230 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
243 assertNotSuggested('bar'); | 231 assertNotSuggested('bar'); |
244 assertNotSuggested('hasLength'); | 232 assertNotSuggested('hasLength'); |
245 assertNotSuggested('identical'); | 233 assertNotSuggested('identical'); |
246 assertNotSuggested('B'); | 234 assertNotSuggested('B'); |
247 assertNotSuggested('Object'); | 235 assertNotSuggested('Object'); |
248 assertNotSuggested('main'); | 236 assertNotSuggested('main'); |
249 assertNotSuggested('baz'); | 237 assertNotSuggested('baz'); |
250 assertNotSuggested('print'); | 238 assertNotSuggested('print'); |
251 } | 239 } |
252 | 240 |
253 test_ArgumentList_MethodInvocation_functionalArg() async { | 241 test_ArgumentList_MethodInvocation_functionalArg() async { |
254 // ArgumentList MethodInvocation ExpressionStatement Block | 242 // ArgumentList MethodInvocation ExpressionStatement Block |
255 addSource( | 243 addSource('/libA.dart', ''' |
256 '/libA.dart', | |
257 ''' | |
258 library A; | 244 library A; |
259 class A { A(f()) { } } | 245 class A { A(f()) { } } |
260 bool hasLength(int expected) { } | 246 bool hasLength(int expected) { } |
261 void baz() { }'''); | 247 void baz() { }'''); |
262 addTestSource(''' | 248 addTestSource(''' |
263 import 'dart:async'; | 249 import 'dart:async'; |
264 import '/libA.dart'; | 250 import '/libA.dart'; |
265 class B { } | 251 class B { } |
266 String bar(f()) => true; | 252 String bar(f()) => true; |
267 void main() {bar(^);}'''); | 253 void main() {bar(^);}'''); |
268 await computeSuggestions(); | 254 await computeSuggestions(); |
269 | 255 |
270 expect(replacementOffset, completionOffset); | 256 expect(replacementOffset, completionOffset); |
271 expect(replacementLength, 0); | 257 expect(replacementLength, 0); |
272 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 258 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
273 assertNotSuggested('bar'); | 259 assertNotSuggested('bar'); |
274 assertNotSuggested('hasLength'); | 260 assertNotSuggested('hasLength'); |
275 assertNotSuggested('identical'); | 261 assertNotSuggested('identical'); |
276 assertNotSuggested('B'); | 262 assertNotSuggested('B'); |
277 assertNotSuggested('A'); | 263 assertNotSuggested('A'); |
278 assertNotSuggested('Object'); | 264 assertNotSuggested('Object'); |
279 assertNotSuggested('main'); | 265 assertNotSuggested('main'); |
280 assertNotSuggested('baz'); | 266 assertNotSuggested('baz'); |
281 assertNotSuggested('print'); | 267 assertNotSuggested('print'); |
282 } | 268 } |
283 | 269 |
284 test_ArgumentList_MethodInvocation_methodArg() async { | 270 test_ArgumentList_MethodInvocation_methodArg() async { |
285 // ArgumentList MethodInvocation ExpressionStatement Block | 271 // ArgumentList MethodInvocation ExpressionStatement Block |
286 addSource( | 272 addSource('/libA.dart', ''' |
287 '/libA.dart', | |
288 ''' | |
289 library A; | 273 library A; |
290 class A { A(f()) { } } | 274 class A { A(f()) { } } |
291 bool hasLength(int expected) { } | 275 bool hasLength(int expected) { } |
292 void baz() { }'''); | 276 void baz() { }'''); |
293 addTestSource(''' | 277 addTestSource(''' |
294 import 'dart:async'; | 278 import 'dart:async'; |
295 import '/libA.dart'; | 279 import '/libA.dart'; |
296 class B { String bar(f()) => true; } | 280 class B { String bar(f()) => true; } |
297 void main() {new B().bar(^);}'''); | 281 void main() {new B().bar(^);}'''); |
298 await computeSuggestions(); | 282 await computeSuggestions(); |
299 | 283 |
300 expect(replacementOffset, completionOffset); | 284 expect(replacementOffset, completionOffset); |
301 expect(replacementLength, 0); | 285 expect(replacementLength, 0); |
302 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 286 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
303 assertNotSuggested('hasLength'); | 287 assertNotSuggested('hasLength'); |
304 assertNotSuggested('identical'); | 288 assertNotSuggested('identical'); |
305 assertNotSuggested('B'); | 289 assertNotSuggested('B'); |
306 assertNotSuggested('A'); | 290 assertNotSuggested('A'); |
307 assertNotSuggested('Object'); | 291 assertNotSuggested('Object'); |
308 assertNotSuggested('main'); | 292 assertNotSuggested('main'); |
309 assertNotSuggested('baz'); | 293 assertNotSuggested('baz'); |
310 assertNotSuggested('print'); | 294 assertNotSuggested('print'); |
311 } | 295 } |
312 | 296 |
313 test_ArgumentList_namedParam() async { | 297 test_ArgumentList_namedParam() async { |
314 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation | 298 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation |
315 // ExpressionStatement | 299 // ExpressionStatement |
316 addSource( | 300 addSource('/libA.dart', ''' |
317 '/libA.dart', | |
318 ''' | |
319 library A; | 301 library A; |
320 bool hasLength(int expected) { }'''); | 302 bool hasLength(int expected) { }'''); |
321 addTestSource(''' | 303 addTestSource(''' |
322 import '/libA.dart' | 304 import '/libA.dart' |
323 String bar() => true; | 305 String bar() => true; |
324 void main() {expect(foo: ^)}'''); | 306 void main() {expect(foo: ^)}'''); |
325 await computeSuggestions(); | 307 await computeSuggestions(); |
326 | 308 |
327 expect(replacementOffset, completionOffset); | 309 expect(replacementOffset, completionOffset); |
328 expect(replacementLength, 0); | 310 expect(replacementLength, 0); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 expect(replacementOffset, completionOffset); | 482 expect(replacementOffset, completionOffset); |
501 expect(replacementLength, 0); | 483 expect(replacementLength, 0); |
502 assertNotSuggested('a'); | 484 assertNotSuggested('a'); |
503 assertNotSuggested('Object'); | 485 assertNotSuggested('Object'); |
504 assertNotSuggested('b'); | 486 assertNotSuggested('b'); |
505 assertNotSuggested('=='); | 487 assertNotSuggested('=='); |
506 } | 488 } |
507 | 489 |
508 test_Block() async { | 490 test_Block() async { |
509 // Block BlockFunctionBody MethodDeclaration | 491 // Block BlockFunctionBody MethodDeclaration |
510 addSource( | 492 addSource('/testAB.dart', ''' |
511 '/testAB.dart', | |
512 ''' | |
513 export "dart:math" hide max; | 493 export "dart:math" hide max; |
514 class A {int x;} | 494 class A {int x;} |
515 @deprecated D1() {int x;} | 495 @deprecated D1() {int x;} |
516 class _B {boo() { partBoo() {}} }'''); | 496 class _B {boo() { partBoo() {}} }'''); |
517 addSource( | 497 addSource('/testCD.dart', ''' |
518 '/testCD.dart', | |
519 ''' | |
520 String T1; | 498 String T1; |
521 var _T2; | 499 var _T2; |
522 class C { } | 500 class C { } |
523 class D { }'''); | 501 class D { }'''); |
524 addSource( | 502 addSource('/testEEF.dart', ''' |
525 '/testEEF.dart', | |
526 ''' | |
527 class EE { } | 503 class EE { } |
528 class F { }'''); | 504 class F { }'''); |
529 addSource('/testG.dart', 'class G { }'); | 505 addSource('/testG.dart', 'class G { }'); |
530 addSource( | 506 addSource('/testH.dart', ''' |
531 '/testH.dart', | |
532 ''' | |
533 class H { } | 507 class H { } |
534 int T3; | 508 int T3; |
535 var _T4;'''); // not imported | 509 var _T4;'''); // not imported |
536 addTestSource(''' | 510 addTestSource(''' |
537 import "/testAB.dart"; | 511 import "/testAB.dart"; |
538 import "/testCD.dart" hide D; | 512 import "/testCD.dart" hide D; |
539 import "/testEEF.dart" show EE; | 513 import "/testEEF.dart" show EE; |
540 import "/testG.dart" as g; | 514 import "/testG.dart" as g; |
541 int T5; | 515 int T5; |
542 var _T6; | 516 var _T6; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 assertNotSuggested('blog'); | 575 assertNotSuggested('blog'); |
602 // TODO (danrubel) suggest HtmlElement as low relevance | 576 // TODO (danrubel) suggest HtmlElement as low relevance |
603 assertNotSuggested('HtmlElement'); | 577 assertNotSuggested('HtmlElement'); |
604 assertNotSuggested('Uri'); | 578 assertNotSuggested('Uri'); |
605 assertNotSuggested('parseIPv6Address'); | 579 assertNotSuggested('parseIPv6Address'); |
606 assertNotSuggested('parseHex'); | 580 assertNotSuggested('parseHex'); |
607 } | 581 } |
608 | 582 |
609 test_Block_final() async { | 583 test_Block_final() async { |
610 // Block BlockFunctionBody MethodDeclaration | 584 // Block BlockFunctionBody MethodDeclaration |
611 addSource( | 585 addSource('/testAB.dart', ''' |
612 '/testAB.dart', | |
613 ''' | |
614 export "dart:math" hide max; | 586 export "dart:math" hide max; |
615 class A {int x;} | 587 class A {int x;} |
616 @deprecated D1() {int x;} | 588 @deprecated D1() {int x;} |
617 class _B {boo() { partBoo() {}} }'''); | 589 class _B {boo() { partBoo() {}} }'''); |
618 addSource( | 590 addSource('/testCD.dart', ''' |
619 '/testCD.dart', | |
620 ''' | |
621 String T1; | 591 String T1; |
622 var _T2; | 592 var _T2; |
623 class C { } | 593 class C { } |
624 class D { }'''); | 594 class D { }'''); |
625 addSource( | 595 addSource('/testEEF.dart', ''' |
626 '/testEEF.dart', | |
627 ''' | |
628 class EE { } | 596 class EE { } |
629 class F { }'''); | 597 class F { }'''); |
630 addSource('/testG.dart', 'class G { }'); | 598 addSource('/testG.dart', 'class G { }'); |
631 addSource( | 599 addSource('/testH.dart', ''' |
632 '/testH.dart', | |
633 ''' | |
634 class H { } | 600 class H { } |
635 int T3; | 601 int T3; |
636 var _T4;'''); // not imported | 602 var _T4;'''); // not imported |
637 addTestSource(''' | 603 addTestSource(''' |
638 import "/testAB.dart"; | 604 import "/testAB.dart"; |
639 import "/testCD.dart" hide D; | 605 import "/testCD.dart" hide D; |
640 import "/testEEF.dart" show EE; | 606 import "/testEEF.dart" show EE; |
641 import "/testG.dart" as g; | 607 import "/testG.dart" as g; |
642 int T5; | 608 int T5; |
643 var _T6; | 609 var _T6; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 | 688 |
723 test_Block_final3() async { | 689 test_Block_final3() async { |
724 addTestSource('main() {final ^ v;}'); | 690 addTestSource('main() {final ^ v;}'); |
725 await computeSuggestions(); | 691 await computeSuggestions(); |
726 | 692 |
727 assertNotSuggested('String'); | 693 assertNotSuggested('String'); |
728 } | 694 } |
729 | 695 |
730 test_Block_final_final() async { | 696 test_Block_final_final() async { |
731 // Block BlockFunctionBody MethodDeclaration | 697 // Block BlockFunctionBody MethodDeclaration |
732 addSource( | 698 addSource('/testAB.dart', ''' |
733 '/testAB.dart', | |
734 ''' | |
735 export "dart:math" hide max; | 699 export "dart:math" hide max; |
736 class A {int x;} | 700 class A {int x;} |
737 @deprecated D1() {int x;} | 701 @deprecated D1() {int x;} |
738 class _B {boo() { partBoo() {}} }'''); | 702 class _B {boo() { partBoo() {}} }'''); |
739 addSource( | 703 addSource('/testCD.dart', ''' |
740 '/testCD.dart', | |
741 ''' | |
742 String T1; | 704 String T1; |
743 var _T2; | 705 var _T2; |
744 class C { } | 706 class C { } |
745 class D { }'''); | 707 class D { }'''); |
746 addSource( | 708 addSource('/testEEF.dart', ''' |
747 '/testEEF.dart', | |
748 ''' | |
749 class EE { } | 709 class EE { } |
750 class F { }'''); | 710 class F { }'''); |
751 addSource('/testG.dart', 'class G { }'); | 711 addSource('/testG.dart', 'class G { }'); |
752 addSource( | 712 addSource('/testH.dart', ''' |
753 '/testH.dart', | |
754 ''' | |
755 class H { } | 713 class H { } |
756 int T3; | 714 int T3; |
757 var _T4;'''); // not imported | 715 var _T4;'''); // not imported |
758 addTestSource(''' | 716 addTestSource(''' |
759 import "/testAB.dart"; | 717 import "/testAB.dart"; |
760 import "/testCD.dart" hide D; | 718 import "/testCD.dart" hide D; |
761 import "/testEEF.dart" show EE; | 719 import "/testEEF.dart" show EE; |
762 import "/testG.dart" as g; | 720 import "/testG.dart" as g; |
763 int T5; | 721 int T5; |
764 var _T6; | 722 var _T6; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 assertNotSuggested('blog'); | 787 assertNotSuggested('blog'); |
830 // TODO (danrubel) suggest HtmlElement as low relevance | 788 // TODO (danrubel) suggest HtmlElement as low relevance |
831 assertNotSuggested('HtmlElement'); | 789 assertNotSuggested('HtmlElement'); |
832 assertNotSuggested('Uri'); | 790 assertNotSuggested('Uri'); |
833 assertNotSuggested('parseIPv6Address'); | 791 assertNotSuggested('parseIPv6Address'); |
834 assertNotSuggested('parseHex'); | 792 assertNotSuggested('parseHex'); |
835 } | 793 } |
836 | 794 |
837 test_Block_final_var() async { | 795 test_Block_final_var() async { |
838 // Block BlockFunctionBody MethodDeclaration | 796 // Block BlockFunctionBody MethodDeclaration |
839 addSource( | 797 addSource('/testAB.dart', ''' |
840 '/testAB.dart', | |
841 ''' | |
842 export "dart:math" hide max; | 798 export "dart:math" hide max; |
843 class A {int x;} | 799 class A {int x;} |
844 @deprecated D1() {int x;} | 800 @deprecated D1() {int x;} |
845 class _B {boo() { partBoo() {}} }'''); | 801 class _B {boo() { partBoo() {}} }'''); |
846 addSource( | 802 addSource('/testCD.dart', ''' |
847 '/testCD.dart', | |
848 ''' | |
849 String T1; | 803 String T1; |
850 var _T2; | 804 var _T2; |
851 class C { } | 805 class C { } |
852 class D { }'''); | 806 class D { }'''); |
853 addSource( | 807 addSource('/testEEF.dart', ''' |
854 '/testEEF.dart', | |
855 ''' | |
856 class EE { } | 808 class EE { } |
857 class F { }'''); | 809 class F { }'''); |
858 addSource('/testG.dart', 'class G { }'); | 810 addSource('/testG.dart', 'class G { }'); |
859 addSource( | 811 addSource('/testH.dart', ''' |
860 '/testH.dart', | |
861 ''' | |
862 class H { } | 812 class H { } |
863 int T3; | 813 int T3; |
864 var _T4;'''); // not imported | 814 var _T4;'''); // not imported |
865 addTestSource(''' | 815 addTestSource(''' |
866 import "/testAB.dart"; | 816 import "/testAB.dart"; |
867 import "/testCD.dart" hide D; | 817 import "/testCD.dart" hide D; |
868 import "/testEEF.dart" show EE; | 818 import "/testEEF.dart" show EE; |
869 import "/testG.dart" as g; | 819 import "/testG.dart" as g; |
870 int T5; | 820 int T5; |
871 var _T6; | 821 var _T6; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 assertNotSuggested('clog'); | 885 assertNotSuggested('clog'); |
936 assertNotSuggested('blog'); | 886 assertNotSuggested('blog'); |
937 // TODO (danrubel) suggest HtmlElement as low relevance | 887 // TODO (danrubel) suggest HtmlElement as low relevance |
938 assertNotSuggested('HtmlElement'); | 888 assertNotSuggested('HtmlElement'); |
939 assertNotSuggested('Uri'); | 889 assertNotSuggested('Uri'); |
940 assertNotSuggested('parseIPv6Address'); | 890 assertNotSuggested('parseIPv6Address'); |
941 assertNotSuggested('parseHex'); | 891 assertNotSuggested('parseHex'); |
942 } | 892 } |
943 | 893 |
944 test_Block_identifier_partial() async { | 894 test_Block_identifier_partial() async { |
945 addSource( | 895 addSource('/testAB.dart', ''' |
946 '/testAB.dart', | |
947 ''' | |
948 export "dart:math" hide max; | 896 export "dart:math" hide max; |
949 class A {int x;} | 897 class A {int x;} |
950 @deprecated D1() {int x;} | 898 @deprecated D1() {int x;} |
951 class _B { }'''); | 899 class _B { }'''); |
952 addSource( | 900 addSource('/testCD.dart', ''' |
953 '/testCD.dart', | |
954 ''' | |
955 String T1; | 901 String T1; |
956 var _T2; | 902 var _T2; |
957 class C { } | 903 class C { } |
958 class D { }'''); | 904 class D { }'''); |
959 addSource( | 905 addSource('/testEEF.dart', ''' |
960 '/testEEF.dart', | |
961 ''' | |
962 class EE { } | 906 class EE { } |
963 class F { }'''); | 907 class F { }'''); |
964 addSource('/testG.dart', 'class G { }'); | 908 addSource('/testG.dart', 'class G { }'); |
965 addSource( | 909 addSource('/testH.dart', ''' |
966 '/testH.dart', | |
967 ''' | |
968 class H { } | 910 class H { } |
969 class D3 { } | 911 class D3 { } |
970 int T3; | 912 int T3; |
971 var _T4;'''); // not imported | 913 var _T4;'''); // not imported |
972 addTestSource(''' | 914 addTestSource(''' |
973 import "/testAB.dart"; | 915 import "/testAB.dart"; |
974 import "/testCD.dart" hide D; | 916 import "/testCD.dart" hide D; |
975 import "/testEEF.dart" show EE; | 917 import "/testEEF.dart" show EE; |
976 import "/testG.dart" as g; | 918 import "/testG.dart" as g; |
977 int T5; | 919 int T5; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 assertNotSuggested('_T4'); | 964 assertNotSuggested('_T4'); |
1023 //assertNotSuggested('T5'); | 965 //assertNotSuggested('T5'); |
1024 //assertSuggestTopLevelVar('_T6', null); | 966 //assertSuggestTopLevelVar('_T6', null); |
1025 assertNotSuggested('=='); | 967 assertNotSuggested('=='); |
1026 // TODO (danrubel) suggest HtmlElement as low relevance | 968 // TODO (danrubel) suggest HtmlElement as low relevance |
1027 assertNotSuggested('HtmlElement'); | 969 assertNotSuggested('HtmlElement'); |
1028 } | 970 } |
1029 | 971 |
1030 test_Block_inherited_imported() async { | 972 test_Block_inherited_imported() async { |
1031 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | 973 // Block BlockFunctionBody MethodDeclaration ClassDeclaration |
1032 addSource( | 974 addSource('/testB.dart', ''' |
1033 '/testB.dart', | |
1034 ''' | |
1035 lib B; | 975 lib B; |
1036 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } | 976 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; } |
1037 class E extends F { var e1; e2() { } } | 977 class E extends F { var e1; e2() { } } |
1038 class I { int i1; i2() { } } | 978 class I { int i1; i2() { } } |
1039 class M { var m1; int m2() { } }'''); | 979 class M { var m1; int m2() { } }'''); |
1040 addTestSource(''' | 980 addTestSource(''' |
1041 import "/testB.dart"; | 981 import "/testB.dart"; |
1042 class A extends E implements I with M {a() {^}}'''); | 982 class A extends E implements I with M {a() {^}}'''); |
1043 await computeSuggestions(); | 983 await computeSuggestions(); |
1044 | 984 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 assertNotSuggested('m1'); | 1018 assertNotSuggested('m1'); |
1079 assertNotSuggested('f3'); | 1019 assertNotSuggested('f3'); |
1080 assertNotSuggested('f4'); | 1020 assertNotSuggested('f4'); |
1081 assertNotSuggested('e2'); | 1021 assertNotSuggested('e2'); |
1082 assertNotSuggested('f2'); | 1022 assertNotSuggested('f2'); |
1083 assertNotSuggested('i2'); | 1023 assertNotSuggested('i2'); |
1084 assertNotSuggested('m2'); | 1024 assertNotSuggested('m2'); |
1085 } | 1025 } |
1086 | 1026 |
1087 test_Block_local_function() async { | 1027 test_Block_local_function() async { |
1088 addSource( | 1028 addSource('/testAB.dart', ''' |
1089 '/testAB.dart', | |
1090 ''' | |
1091 export "dart:math" hide max; | 1029 export "dart:math" hide max; |
1092 class A {int x;} | 1030 class A {int x;} |
1093 @deprecated D1() {int x;} | 1031 @deprecated D1() {int x;} |
1094 class _B {boo() { partBoo() {}} }'''); | 1032 class _B {boo() { partBoo() {}} }'''); |
1095 addSource( | 1033 addSource('/testCD.dart', ''' |
1096 '/testCD.dart', | |
1097 ''' | |
1098 String T1; | 1034 String T1; |
1099 var _T2; | 1035 var _T2; |
1100 class C { } | 1036 class C { } |
1101 class D { }'''); | 1037 class D { }'''); |
1102 addSource( | 1038 addSource('/testEEF.dart', ''' |
1103 '/testEEF.dart', | |
1104 ''' | |
1105 class EE { } | 1039 class EE { } |
1106 class F { }'''); | 1040 class F { }'''); |
1107 addSource('/testG.dart', 'class G { }'); | 1041 addSource('/testG.dart', 'class G { }'); |
1108 addSource( | 1042 addSource('/testH.dart', ''' |
1109 '/testH.dart', | |
1110 ''' | |
1111 class H { } | 1043 class H { } |
1112 int T3; | 1044 int T3; |
1113 var _T4;'''); // not imported | 1045 var _T4;'''); // not imported |
1114 addTestSource(''' | 1046 addTestSource(''' |
1115 import "/testAB.dart"; | 1047 import "/testAB.dart"; |
1116 import "/testCD.dart" hide D; | 1048 import "/testCD.dart" hide D; |
1117 import "/testEEF.dart" show EE; | 1049 import "/testEEF.dart" show EE; |
1118 import "/testG.dart" as g; | 1050 import "/testG.dart" as g; |
1119 int T5; | 1051 int T5; |
1120 var _T6; | 1052 var _T6; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 expect(replacementOffset, completionOffset - 1); | 1086 expect(replacementOffset, completionOffset - 1); |
1155 expect(replacementLength, 1); | 1087 expect(replacementLength, 1); |
1156 assertNotSuggested('Foo'); | 1088 assertNotSuggested('Foo'); |
1157 // TODO(danrubel) implement | 1089 // TODO(danrubel) implement |
1158 assertNotSuggested('Foo2'); | 1090 assertNotSuggested('Foo2'); |
1159 assertNotSuggested('Future'); | 1091 assertNotSuggested('Future'); |
1160 } | 1092 } |
1161 | 1093 |
1162 test_CascadeExpression_selector1() async { | 1094 test_CascadeExpression_selector1() async { |
1163 // PropertyAccess CascadeExpression ExpressionStatement Block | 1095 // PropertyAccess CascadeExpression ExpressionStatement Block |
1164 addSource( | 1096 addSource('/testB.dart', ''' |
1165 '/testB.dart', | |
1166 ''' | |
1167 class B { }'''); | 1097 class B { }'''); |
1168 addTestSource(''' | 1098 addTestSource(''' |
1169 import "/testB.dart"; | 1099 import "/testB.dart"; |
1170 class A {var b; X _c;} | 1100 class A {var b; X _c;} |
1171 class X{} | 1101 class X{} |
1172 // looks like a cascade to the parser | 1102 // looks like a cascade to the parser |
1173 // but the user is trying to get completions for a non-cascade | 1103 // but the user is trying to get completions for a non-cascade |
1174 main() {A a; a.^.z}'''); | 1104 main() {A a; a.^.z}'''); |
1175 await computeSuggestions(); | 1105 await computeSuggestions(); |
1176 | 1106 |
1177 expect(replacementOffset, completionOffset); | 1107 expect(replacementOffset, completionOffset); |
1178 expect(replacementLength, 0); | 1108 expect(replacementLength, 0); |
1179 assertNotSuggested('b'); | 1109 assertNotSuggested('b'); |
1180 assertNotSuggested('_c'); | 1110 assertNotSuggested('_c'); |
1181 assertNotSuggested('Object'); | 1111 assertNotSuggested('Object'); |
1182 assertNotSuggested('A'); | 1112 assertNotSuggested('A'); |
1183 assertNotSuggested('B'); | 1113 assertNotSuggested('B'); |
1184 assertNotSuggested('X'); | 1114 assertNotSuggested('X'); |
1185 assertNotSuggested('z'); | 1115 assertNotSuggested('z'); |
1186 assertNotSuggested('=='); | 1116 assertNotSuggested('=='); |
1187 } | 1117 } |
1188 | 1118 |
1189 test_CascadeExpression_selector2() async { | 1119 test_CascadeExpression_selector2() async { |
1190 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement | 1120 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement |
1191 addSource( | 1121 addSource('/testB.dart', ''' |
1192 '/testB.dart', | |
1193 ''' | |
1194 class B { }'''); | 1122 class B { }'''); |
1195 addTestSource(''' | 1123 addTestSource(''' |
1196 import "/testB.dart"; | 1124 import "/testB.dart"; |
1197 class A {var b; X _c;} | 1125 class A {var b; X _c;} |
1198 class X{} | 1126 class X{} |
1199 main() {A a; a..^z}'''); | 1127 main() {A a; a..^z}'''); |
1200 await computeSuggestions(); | 1128 await computeSuggestions(); |
1201 | 1129 |
1202 expect(replacementOffset, completionOffset); | 1130 expect(replacementOffset, completionOffset); |
1203 expect(replacementLength, 1); | 1131 expect(replacementLength, 1); |
1204 assertNotSuggested('b'); | 1132 assertNotSuggested('b'); |
1205 assertNotSuggested('_c'); | 1133 assertNotSuggested('_c'); |
1206 assertNotSuggested('Object'); | 1134 assertNotSuggested('Object'); |
1207 assertNotSuggested('A'); | 1135 assertNotSuggested('A'); |
1208 assertNotSuggested('B'); | 1136 assertNotSuggested('B'); |
1209 assertNotSuggested('X'); | 1137 assertNotSuggested('X'); |
1210 assertNotSuggested('z'); | 1138 assertNotSuggested('z'); |
1211 assertNotSuggested('=='); | 1139 assertNotSuggested('=='); |
1212 } | 1140 } |
1213 | 1141 |
1214 test_CascadeExpression_selector2_withTrailingReturn() async { | 1142 test_CascadeExpression_selector2_withTrailingReturn() async { |
1215 // PropertyAccess CascadeExpression ExpressionStatement Block | 1143 // PropertyAccess CascadeExpression ExpressionStatement Block |
1216 addSource( | 1144 addSource('/testB.dart', ''' |
1217 '/testB.dart', | |
1218 ''' | |
1219 class B { }'''); | 1145 class B { }'''); |
1220 addTestSource(''' | 1146 addTestSource(''' |
1221 import "/testB.dart"; | 1147 import "/testB.dart"; |
1222 class A {var b; X _c;} | 1148 class A {var b; X _c;} |
1223 class X{} | 1149 class X{} |
1224 main() {A a; a..^ return}'''); | 1150 main() {A a; a..^ return}'''); |
1225 await computeSuggestions(); | 1151 await computeSuggestions(); |
1226 | 1152 |
1227 expect(replacementOffset, completionOffset); | 1153 expect(replacementOffset, completionOffset); |
1228 expect(replacementLength, 0); | 1154 expect(replacementLength, 0); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 expect(replacementLength, 0); | 1229 expect(replacementLength, 0); |
1304 assertNotSuggested('e'); | 1230 assertNotSuggested('e'); |
1305 assertNotSuggested('s'); | 1231 assertNotSuggested('s'); |
1306 assertNotSuggested('a'); | 1232 assertNotSuggested('a'); |
1307 assertNotSuggested('Object'); | 1233 assertNotSuggested('Object'); |
1308 assertNotSuggested('x'); | 1234 assertNotSuggested('x'); |
1309 } | 1235 } |
1310 | 1236 |
1311 test_ClassDeclaration_body() async { | 1237 test_ClassDeclaration_body() async { |
1312 // ClassDeclaration CompilationUnit | 1238 // ClassDeclaration CompilationUnit |
1313 addSource( | 1239 addSource('/testB.dart', ''' |
1314 '/testB.dart', | |
1315 ''' | |
1316 class B { }'''); | 1240 class B { }'''); |
1317 addTestSource(''' | 1241 addTestSource(''' |
1318 import "testB.dart" as x; | 1242 import "testB.dart" as x; |
1319 @deprecated class A {^} | 1243 @deprecated class A {^} |
1320 class _B {} | 1244 class _B {} |
1321 A T;'''); | 1245 A T;'''); |
1322 await computeSuggestions(); | 1246 await computeSuggestions(); |
1323 | 1247 |
1324 expect(replacementOffset, completionOffset); | 1248 expect(replacementOffset, completionOffset); |
1325 expect(replacementLength, 0); | 1249 expect(replacementLength, 0); |
1326 assertNotSuggested('A'); | 1250 assertNotSuggested('A'); |
1327 assertNotSuggested('_B'); | 1251 assertNotSuggested('_B'); |
1328 assertNotSuggested('Object'); | 1252 assertNotSuggested('Object'); |
1329 assertNotSuggested('T'); | 1253 assertNotSuggested('T'); |
1330 // Suggested by LibraryPrefixContributor | 1254 // Suggested by LibraryPrefixContributor |
1331 assertNotSuggested('x'); | 1255 assertNotSuggested('x'); |
1332 } | 1256 } |
1333 | 1257 |
1334 test_ClassDeclaration_body_final() async { | 1258 test_ClassDeclaration_body_final() async { |
1335 // ClassDeclaration CompilationUnit | 1259 // ClassDeclaration CompilationUnit |
1336 addSource( | 1260 addSource('/testB.dart', ''' |
1337 '/testB.dart', | |
1338 ''' | |
1339 class B { }'''); | 1261 class B { }'''); |
1340 addTestSource(''' | 1262 addTestSource(''' |
1341 import "testB.dart" as x; | 1263 import "testB.dart" as x; |
1342 class A {final ^} | 1264 class A {final ^} |
1343 class _B {} | 1265 class _B {} |
1344 A T;'''); | 1266 A T;'''); |
1345 await computeSuggestions(); | 1267 await computeSuggestions(); |
1346 | 1268 |
1347 expect(replacementOffset, completionOffset); | 1269 expect(replacementOffset, completionOffset); |
1348 expect(replacementLength, 0); | 1270 expect(replacementLength, 0); |
1349 assertNotSuggested('A'); | 1271 assertNotSuggested('A'); |
1350 assertNotSuggested('_B'); | 1272 assertNotSuggested('_B'); |
1351 assertNotSuggested('Object'); | 1273 assertNotSuggested('Object'); |
1352 assertNotSuggested('T'); | 1274 assertNotSuggested('T'); |
1353 // Suggested by LibraryPrefixContributor | 1275 // Suggested by LibraryPrefixContributor |
1354 assertNotSuggested('x'); | 1276 assertNotSuggested('x'); |
1355 } | 1277 } |
1356 | 1278 |
1357 test_ClassDeclaration_body_final_field() async { | 1279 test_ClassDeclaration_body_final_field() async { |
1358 // ClassDeclaration CompilationUnit | 1280 // ClassDeclaration CompilationUnit |
1359 addSource( | 1281 addSource('/testB.dart', ''' |
1360 '/testB.dart', | |
1361 ''' | |
1362 class B { }'''); | 1282 class B { }'''); |
1363 addTestSource(''' | 1283 addTestSource(''' |
1364 import "testB.dart" as x; | 1284 import "testB.dart" as x; |
1365 class A {final ^ A(){}} | 1285 class A {final ^ A(){}} |
1366 class _B {} | 1286 class _B {} |
1367 A T;'''); | 1287 A T;'''); |
1368 await computeSuggestions(); | 1288 await computeSuggestions(); |
1369 | 1289 |
1370 expect(replacementOffset, completionOffset); | 1290 expect(replacementOffset, completionOffset); |
1371 expect(replacementLength, 0); | 1291 expect(replacementLength, 0); |
1372 assertNotSuggested('A'); | 1292 assertNotSuggested('A'); |
1373 assertNotSuggested('_B'); | 1293 assertNotSuggested('_B'); |
1374 assertNotSuggested('String'); | 1294 assertNotSuggested('String'); |
1375 assertNotSuggested('T'); | 1295 assertNotSuggested('T'); |
1376 // Suggested by LibraryPrefixContributor | 1296 // Suggested by LibraryPrefixContributor |
1377 assertNotSuggested('x'); | 1297 assertNotSuggested('x'); |
1378 } | 1298 } |
1379 | 1299 |
1380 test_ClassDeclaration_body_final_field2() async { | 1300 test_ClassDeclaration_body_final_field2() async { |
1381 // ClassDeclaration CompilationUnit | 1301 // ClassDeclaration CompilationUnit |
1382 addSource( | 1302 addSource('/testB.dart', ''' |
1383 '/testB.dart', | |
1384 ''' | |
1385 class B { }'''); | 1303 class B { }'''); |
1386 addTestSource(''' | 1304 addTestSource(''' |
1387 import "testB.dart" as Soo; | 1305 import "testB.dart" as Soo; |
1388 class A {final S^ A();} | 1306 class A {final S^ A();} |
1389 class _B {} | 1307 class _B {} |
1390 A Sew;'''); | 1308 A Sew;'''); |
1391 await computeSuggestions(); | 1309 await computeSuggestions(); |
1392 | 1310 |
1393 expect(replacementOffset, completionOffset - 1); | 1311 expect(replacementOffset, completionOffset - 1); |
1394 expect(replacementLength, 1); | 1312 expect(replacementLength, 1); |
1395 assertNotSuggested('A'); | 1313 assertNotSuggested('A'); |
1396 assertNotSuggested('_B'); | 1314 assertNotSuggested('_B'); |
1397 assertNotSuggested('String'); | 1315 assertNotSuggested('String'); |
1398 assertNotSuggested('Sew'); | 1316 assertNotSuggested('Sew'); |
1399 // Suggested by LibraryPrefixContributor | 1317 // Suggested by LibraryPrefixContributor |
1400 assertNotSuggested('Soo'); | 1318 assertNotSuggested('Soo'); |
1401 } | 1319 } |
1402 | 1320 |
1403 test_ClassDeclaration_body_final_final() async { | 1321 test_ClassDeclaration_body_final_final() async { |
1404 // ClassDeclaration CompilationUnit | 1322 // ClassDeclaration CompilationUnit |
1405 addSource( | 1323 addSource('/testB.dart', ''' |
1406 '/testB.dart', | |
1407 ''' | |
1408 class B { }'''); | 1324 class B { }'''); |
1409 addTestSource(''' | 1325 addTestSource(''' |
1410 import "testB.dart" as x; | 1326 import "testB.dart" as x; |
1411 class A {final ^ final foo;} | 1327 class A {final ^ final foo;} |
1412 class _B {} | 1328 class _B {} |
1413 A T;'''); | 1329 A T;'''); |
1414 await computeSuggestions(); | 1330 await computeSuggestions(); |
1415 | 1331 |
1416 expect(replacementOffset, completionOffset); | 1332 expect(replacementOffset, completionOffset); |
1417 expect(replacementLength, 0); | 1333 expect(replacementLength, 0); |
1418 assertNotSuggested('A'); | 1334 assertNotSuggested('A'); |
1419 assertNotSuggested('_B'); | 1335 assertNotSuggested('_B'); |
1420 assertNotSuggested('Object'); | 1336 assertNotSuggested('Object'); |
1421 assertNotSuggested('T'); | 1337 assertNotSuggested('T'); |
1422 // Suggested by LibraryPrefixContributor | 1338 // Suggested by LibraryPrefixContributor |
1423 assertNotSuggested('x'); | 1339 assertNotSuggested('x'); |
1424 } | 1340 } |
1425 | 1341 |
1426 test_ClassDeclaration_body_final_var() async { | 1342 test_ClassDeclaration_body_final_var() async { |
1427 // ClassDeclaration CompilationUnit | 1343 // ClassDeclaration CompilationUnit |
1428 addSource( | 1344 addSource('/testB.dart', ''' |
1429 '/testB.dart', | |
1430 ''' | |
1431 class B { }'''); | 1345 class B { }'''); |
1432 addTestSource(''' | 1346 addTestSource(''' |
1433 import "testB.dart" as x; | 1347 import "testB.dart" as x; |
1434 class A {final ^ var foo;} | 1348 class A {final ^ var foo;} |
1435 class _B {} | 1349 class _B {} |
1436 A T;'''); | 1350 A T;'''); |
1437 await computeSuggestions(); | 1351 await computeSuggestions(); |
1438 | 1352 |
1439 expect(replacementOffset, completionOffset); | 1353 expect(replacementOffset, completionOffset); |
1440 expect(replacementLength, 0); | 1354 expect(replacementLength, 0); |
1441 assertNotSuggested('A'); | 1355 assertNotSuggested('A'); |
1442 assertNotSuggested('_B'); | 1356 assertNotSuggested('_B'); |
1443 assertNotSuggested('Object'); | 1357 assertNotSuggested('Object'); |
1444 assertNotSuggested('T'); | 1358 assertNotSuggested('T'); |
1445 // Suggested by LibraryPrefixContributor | 1359 // Suggested by LibraryPrefixContributor |
1446 assertNotSuggested('x'); | 1360 assertNotSuggested('x'); |
1447 } | 1361 } |
1448 | 1362 |
1449 test_Combinator_hide() async { | 1363 test_Combinator_hide() async { |
1450 // SimpleIdentifier HideCombinator ImportDirective | 1364 // SimpleIdentifier HideCombinator ImportDirective |
1451 addSource( | 1365 addSource('/testAB.dart', ''' |
1452 '/testAB.dart', | |
1453 ''' | |
1454 library libAB; | 1366 library libAB; |
1455 part '/partAB.dart'; | 1367 part '/partAB.dart'; |
1456 class A { } | 1368 class A { } |
1457 class B { }'''); | 1369 class B { }'''); |
1458 addSource( | 1370 addSource('/partAB.dart', ''' |
1459 '/partAB.dart', | |
1460 ''' | |
1461 part of libAB; | 1371 part of libAB; |
1462 var T1; | 1372 var T1; |
1463 PB F1() => new PB(); | 1373 PB F1() => new PB(); |
1464 class PB { }'''); | 1374 class PB { }'''); |
1465 addSource( | 1375 addSource('/testCD.dart', ''' |
1466 '/testCD.dart', | |
1467 ''' | |
1468 class C { } | 1376 class C { } |
1469 class D { }'''); | 1377 class D { }'''); |
1470 addTestSource(''' | 1378 addTestSource(''' |
1471 import "/testAB.dart" hide ^; | 1379 import "/testAB.dart" hide ^; |
1472 import "/testCD.dart"; | 1380 import "/testCD.dart"; |
1473 class X {}'''); | 1381 class X {}'''); |
1474 await computeSuggestions(); | 1382 await computeSuggestions(); |
1475 | 1383 |
1476 assertNoSuggestions(); | 1384 assertNoSuggestions(); |
1477 } | 1385 } |
1478 | 1386 |
1479 test_Combinator_show() async { | 1387 test_Combinator_show() async { |
1480 // SimpleIdentifier HideCombinator ImportDirective | 1388 // SimpleIdentifier HideCombinator ImportDirective |
1481 addSource( | 1389 addSource('/testAB.dart', ''' |
1482 '/testAB.dart', | |
1483 ''' | |
1484 library libAB; | 1390 library libAB; |
1485 part '/partAB.dart'; | 1391 part '/partAB.dart'; |
1486 class A { } | 1392 class A { } |
1487 class B { }'''); | 1393 class B { }'''); |
1488 addSource( | 1394 addSource('/partAB.dart', ''' |
1489 '/partAB.dart', | |
1490 ''' | |
1491 part of libAB; | 1395 part of libAB; |
1492 var T1; | 1396 var T1; |
1493 PB F1() => new PB(); | 1397 PB F1() => new PB(); |
1494 typedef PB2 F2(int blat); | 1398 typedef PB2 F2(int blat); |
1495 class Clz = Object with Object; | 1399 class Clz = Object with Object; |
1496 class PB { }'''); | 1400 class PB { }'''); |
1497 addSource( | 1401 addSource('/testCD.dart', ''' |
1498 '/testCD.dart', | |
1499 ''' | |
1500 class C { } | 1402 class C { } |
1501 class D { }'''); | 1403 class D { }'''); |
1502 addTestSource(''' | 1404 addTestSource(''' |
1503 import "/testAB.dart" show ^; | 1405 import "/testAB.dart" show ^; |
1504 import "/testCD.dart"; | 1406 import "/testCD.dart"; |
1505 class X {}'''); | 1407 class X {}'''); |
1506 await computeSuggestions(); | 1408 await computeSuggestions(); |
1507 | 1409 |
1508 assertNoSuggestions(); | 1410 assertNoSuggestions(); |
1509 } | 1411 } |
1510 | 1412 |
1511 test_ConditionalExpression_elseExpression() async { | 1413 test_ConditionalExpression_elseExpression() async { |
1512 // SimpleIdentifier ConditionalExpression ReturnStatement | 1414 // SimpleIdentifier ConditionalExpression ReturnStatement |
1513 addSource( | 1415 addSource('/testA.dart', ''' |
1514 '/testA.dart', | |
1515 ''' | |
1516 int T1; | 1416 int T1; |
1517 F1() { } | 1417 F1() { } |
1518 class A {int x;}'''); | 1418 class A {int x;}'''); |
1519 addTestSource(''' | 1419 addTestSource(''' |
1520 import "/testA.dart"; | 1420 import "/testA.dart"; |
1521 int T2; | 1421 int T2; |
1522 F2() { } | 1422 F2() { } |
1523 class B {int x;} | 1423 class B {int x;} |
1524 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); | 1424 class C {foo(){var f; {var x;} return a ? T1 : T^}}'''); |
1525 await computeSuggestions(); | 1425 await computeSuggestions(); |
1526 | 1426 |
1527 // top level results are partially filtered based on first char | 1427 // top level results are partially filtered based on first char |
1528 assertNotSuggested('T2'); | 1428 assertNotSuggested('T2'); |
1529 // TODO (danrubel) getter is being suggested instead of top level var | 1429 // TODO (danrubel) getter is being suggested instead of top level var |
1530 //assertNotSuggested('T1'); | 1430 //assertNotSuggested('T1'); |
1531 } | 1431 } |
1532 | 1432 |
1533 test_ConditionalExpression_elseExpression_empty() async { | 1433 test_ConditionalExpression_elseExpression_empty() async { |
1534 // SimpleIdentifier ConditionalExpression ReturnStatement | 1434 // SimpleIdentifier ConditionalExpression ReturnStatement |
1535 addSource( | 1435 addSource('/testA.dart', ''' |
1536 '/testA.dart', | |
1537 ''' | |
1538 int T1; | 1436 int T1; |
1539 F1() { } | 1437 F1() { } |
1540 class A {int x;}'''); | 1438 class A {int x;}'''); |
1541 addTestSource(''' | 1439 addTestSource(''' |
1542 import "/testA.dart"; | 1440 import "/testA.dart"; |
1543 int T2; | 1441 int T2; |
1544 F2() { } | 1442 F2() { } |
1545 class B {int x;} | 1443 class B {int x;} |
1546 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); | 1444 class C {foo(){var f; {var x;} return a ? T1 : ^}}'''); |
1547 await computeSuggestions(); | 1445 await computeSuggestions(); |
1548 | 1446 |
1549 assertNotSuggested('x'); | 1447 assertNotSuggested('x'); |
1550 assertNotSuggested('f'); | 1448 assertNotSuggested('f'); |
1551 assertNotSuggested('foo'); | 1449 assertNotSuggested('foo'); |
1552 assertNotSuggested('C'); | 1450 assertNotSuggested('C'); |
1553 assertNotSuggested('F2'); | 1451 assertNotSuggested('F2'); |
1554 assertNotSuggested('T2'); | 1452 assertNotSuggested('T2'); |
1555 assertNotSuggested('A'); | 1453 assertNotSuggested('A'); |
1556 assertNotSuggested('F1'); | 1454 assertNotSuggested('F1'); |
1557 // TODO (danrubel) getter is being suggested instead of top level var | 1455 // TODO (danrubel) getter is being suggested instead of top level var |
1558 //assertNotSuggested('T1'); | 1456 //assertNotSuggested('T1'); |
1559 } | 1457 } |
1560 | 1458 |
1561 test_ConditionalExpression_partial_thenExpression() async { | 1459 test_ConditionalExpression_partial_thenExpression() async { |
1562 // SimpleIdentifier ConditionalExpression ReturnStatement | 1460 // SimpleIdentifier ConditionalExpression ReturnStatement |
1563 addSource( | 1461 addSource('/testA.dart', ''' |
1564 '/testA.dart', | |
1565 ''' | |
1566 int T1; | 1462 int T1; |
1567 F1() { } | 1463 F1() { } |
1568 class A {int x;}'''); | 1464 class A {int x;}'''); |
1569 addTestSource(''' | 1465 addTestSource(''' |
1570 import "/testA.dart"; | 1466 import "/testA.dart"; |
1571 int T2; | 1467 int T2; |
1572 F2() { } | 1468 F2() { } |
1573 class B {int x;} | 1469 class B {int x;} |
1574 class C {foo(){var f; {var x;} return a ? T^}}'''); | 1470 class C {foo(){var f; {var x;} return a ? T^}}'''); |
1575 await computeSuggestions(); | 1471 await computeSuggestions(); |
1576 | 1472 |
1577 // top level results are partially filtered based on first char | 1473 // top level results are partially filtered based on first char |
1578 assertNotSuggested('T2'); | 1474 assertNotSuggested('T2'); |
1579 // TODO (danrubel) getter is being suggested instead of top level var | 1475 // TODO (danrubel) getter is being suggested instead of top level var |
1580 //assertNotSuggested('T1'); | 1476 //assertNotSuggested('T1'); |
1581 } | 1477 } |
1582 | 1478 |
1583 test_ConditionalExpression_partial_thenExpression_empty() async { | 1479 test_ConditionalExpression_partial_thenExpression_empty() async { |
1584 // SimpleIdentifier ConditionalExpression ReturnStatement | 1480 // SimpleIdentifier ConditionalExpression ReturnStatement |
1585 addSource( | 1481 addSource('/testA.dart', ''' |
1586 '/testA.dart', | |
1587 ''' | |
1588 int T1; | 1482 int T1; |
1589 F1() { } | 1483 F1() { } |
1590 class A {int x;}'''); | 1484 class A {int x;}'''); |
1591 addTestSource(''' | 1485 addTestSource(''' |
1592 import "/testA.dart"; | 1486 import "/testA.dart"; |
1593 int T2; | 1487 int T2; |
1594 F2() { } | 1488 F2() { } |
1595 class B {int x;} | 1489 class B {int x;} |
1596 class C {foo(){var f; {var x;} return a ? ^}}'''); | 1490 class C {foo(){var f; {var x;} return a ? ^}}'''); |
1597 await computeSuggestions(); | 1491 await computeSuggestions(); |
1598 | 1492 |
1599 assertNotSuggested('x'); | 1493 assertNotSuggested('x'); |
1600 assertNotSuggested('f'); | 1494 assertNotSuggested('f'); |
1601 assertNotSuggested('foo'); | 1495 assertNotSuggested('foo'); |
1602 assertNotSuggested('C'); | 1496 assertNotSuggested('C'); |
1603 assertNotSuggested('F2'); | 1497 assertNotSuggested('F2'); |
1604 assertNotSuggested('T2'); | 1498 assertNotSuggested('T2'); |
1605 assertNotSuggested('A'); | 1499 assertNotSuggested('A'); |
1606 assertNotSuggested('F1'); | 1500 assertNotSuggested('F1'); |
1607 // TODO (danrubel) getter is being suggested instead of top level var | 1501 // TODO (danrubel) getter is being suggested instead of top level var |
1608 //assertNotSuggested('T1'); | 1502 //assertNotSuggested('T1'); |
1609 } | 1503 } |
1610 | 1504 |
1611 test_ConditionalExpression_thenExpression() async { | 1505 test_ConditionalExpression_thenExpression() async { |
1612 // SimpleIdentifier ConditionalExpression ReturnStatement | 1506 // SimpleIdentifier ConditionalExpression ReturnStatement |
1613 addSource( | 1507 addSource('/testA.dart', ''' |
1614 '/testA.dart', | |
1615 ''' | |
1616 int T1; | 1508 int T1; |
1617 F1() { } | 1509 F1() { } |
1618 class A {int x;}'''); | 1510 class A {int x;}'''); |
1619 addTestSource(''' | 1511 addTestSource(''' |
1620 import "/testA.dart"; | 1512 import "/testA.dart"; |
1621 int T2; | 1513 int T2; |
1622 F2() { } | 1514 F2() { } |
1623 class B {int x;} | 1515 class B {int x;} |
1624 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); | 1516 class C {foo(){var f; {var x;} return a ? T^ : c}}'''); |
1625 await computeSuggestions(); | 1517 await computeSuggestions(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 test_constructor_parameters_required() async { | 1553 test_constructor_parameters_required() async { |
1662 addTestSource('class A {A(x, int y) {^}}'); | 1554 addTestSource('class A {A(x, int y) {^}}'); |
1663 await computeSuggestions(); | 1555 await computeSuggestions(); |
1664 assertNotSuggested('x'); | 1556 assertNotSuggested('x'); |
1665 assertNotSuggested('y'); | 1557 assertNotSuggested('y'); |
1666 } | 1558 } |
1667 | 1559 |
1668 test_ConstructorName_importedClass() async { | 1560 test_ConstructorName_importedClass() async { |
1669 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1561 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1670 // InstanceCreationExpression | 1562 // InstanceCreationExpression |
1671 addSource( | 1563 addSource('/testB.dart', ''' |
1672 '/testB.dart', | |
1673 ''' | |
1674 lib B; | 1564 lib B; |
1675 int T1; | 1565 int T1; |
1676 F1() { } | 1566 F1() { } |
1677 class X {X.c(); X._d(); z() {}}'''); | 1567 class X {X.c(); X._d(); z() {}}'''); |
1678 addTestSource(''' | 1568 addTestSource(''' |
1679 import "/testB.dart"; | 1569 import "/testB.dart"; |
1680 var m; | 1570 var m; |
1681 main() {new X.^}'''); | 1571 main() {new X.^}'''); |
1682 await computeSuggestions(); | 1572 await computeSuggestions(); |
1683 | 1573 |
1684 expect(replacementOffset, completionOffset); | 1574 expect(replacementOffset, completionOffset); |
1685 expect(replacementLength, 0); | 1575 expect(replacementLength, 0); |
1686 // Suggested by NamedConstructorContributor | 1576 // Suggested by NamedConstructorContributor |
1687 assertNotSuggested('c'); | 1577 assertNotSuggested('c'); |
1688 assertNotSuggested('F1'); | 1578 assertNotSuggested('F1'); |
1689 assertNotSuggested('T1'); | 1579 assertNotSuggested('T1'); |
1690 assertNotSuggested('_d'); | 1580 assertNotSuggested('_d'); |
1691 assertNotSuggested('z'); | 1581 assertNotSuggested('z'); |
1692 assertNotSuggested('m'); | 1582 assertNotSuggested('m'); |
1693 } | 1583 } |
1694 | 1584 |
1695 test_ConstructorName_importedFactory() async { | 1585 test_ConstructorName_importedFactory() async { |
1696 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName | 1586 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName |
1697 // InstanceCreationExpression | 1587 // InstanceCreationExpression |
1698 addSource( | 1588 addSource('/testB.dart', ''' |
1699 '/testB.dart', | |
1700 ''' | |
1701 lib B; | 1589 lib B; |
1702 int T1; | 1590 int T1; |
1703 F1() { } | 1591 F1() { } |
1704 class X {factory X.c(); factory X._d(); z() {}}'''); | 1592 class X {factory X.c(); factory X._d(); z() {}}'''); |
1705 addTestSource(''' | 1593 addTestSource(''' |
1706 import "/testB.dart"; | 1594 import "/testB.dart"; |
1707 var m; | 1595 var m; |
1708 main() {new X.^}'''); | 1596 main() {new X.^}'''); |
1709 await computeSuggestions(); | 1597 await computeSuggestions(); |
1710 | 1598 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 test_enum_deprecated() async { | 1696 test_enum_deprecated() async { |
1809 addTestSource('@deprecated enum E { one, two } main() {^}'); | 1697 addTestSource('@deprecated enum E { one, two } main() {^}'); |
1810 await computeSuggestions(); | 1698 await computeSuggestions(); |
1811 assertNotSuggested('E'); | 1699 assertNotSuggested('E'); |
1812 assertNotSuggested('one'); | 1700 assertNotSuggested('one'); |
1813 assertNotSuggested('two'); | 1701 assertNotSuggested('two'); |
1814 } | 1702 } |
1815 | 1703 |
1816 test_ExpressionStatement_identifier() async { | 1704 test_ExpressionStatement_identifier() async { |
1817 // SimpleIdentifier ExpressionStatement Block | 1705 // SimpleIdentifier ExpressionStatement Block |
1818 addSource( | 1706 addSource('/testA.dart', ''' |
1819 '/testA.dart', | |
1820 ''' | |
1821 _B F1() { } | 1707 _B F1() { } |
1822 class A {int x;} | 1708 class A {int x;} |
1823 class _B { }'''); | 1709 class _B { }'''); |
1824 addTestSource(''' | 1710 addTestSource(''' |
1825 import "/testA.dart"; | 1711 import "/testA.dart"; |
1826 typedef int F2(int blat); | 1712 typedef int F2(int blat); |
1827 class Clz = Object with Object; | 1713 class Clz = Object with Object; |
1828 class C {foo(){^} void bar() {}}'''); | 1714 class C {foo(){^} void bar() {}}'''); |
1829 await computeSuggestions(); | 1715 await computeSuggestions(); |
1830 | 1716 |
1831 expect(replacementOffset, completionOffset); | 1717 expect(replacementOffset, completionOffset); |
1832 expect(replacementLength, 0); | 1718 expect(replacementLength, 0); |
1833 assertNotSuggested('A'); | 1719 assertNotSuggested('A'); |
1834 assertNotSuggested('F1'); | 1720 assertNotSuggested('F1'); |
1835 assertNotSuggested('C'); | 1721 assertNotSuggested('C'); |
1836 assertNotSuggested('foo'); | 1722 assertNotSuggested('foo'); |
1837 assertNotSuggested('bar'); | 1723 assertNotSuggested('bar'); |
1838 assertNotSuggested('F2'); | 1724 assertNotSuggested('F2'); |
1839 assertNotSuggested('Clz'); | 1725 assertNotSuggested('Clz'); |
1840 assertNotSuggested('C'); | 1726 assertNotSuggested('C'); |
1841 assertNotSuggested('x'); | 1727 assertNotSuggested('x'); |
1842 assertNotSuggested('_B'); | 1728 assertNotSuggested('_B'); |
1843 } | 1729 } |
1844 | 1730 |
1845 test_ExpressionStatement_name() async { | 1731 test_ExpressionStatement_name() async { |
1846 // ExpressionStatement Block BlockFunctionBody MethodDeclaration | 1732 // ExpressionStatement Block BlockFunctionBody MethodDeclaration |
1847 addSource( | 1733 addSource('/testA.dart', ''' |
1848 '/testA.dart', | |
1849 ''' | |
1850 B T1; | 1734 B T1; |
1851 class B{}'''); | 1735 class B{}'''); |
1852 addTestSource(''' | 1736 addTestSource(''' |
1853 import "/testA.dart"; | 1737 import "/testA.dart"; |
1854 class C {a() {C ^}}'''); | 1738 class C {a() {C ^}}'''); |
1855 await computeSuggestions(); | 1739 await computeSuggestions(); |
1856 | 1740 |
1857 assertNoSuggestions(); | 1741 assertNoSuggestions(); |
1858 } | 1742 } |
1859 | 1743 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 class B extends A { | 1981 class B extends A { |
2098 main() {^} | 1982 main() {^} |
2099 } | 1983 } |
2100 '''); | 1984 '''); |
2101 await computeSuggestions(); | 1985 await computeSuggestions(); |
2102 assertNotSuggested('m'); | 1986 assertNotSuggested('m'); |
2103 } | 1987 } |
2104 | 1988 |
2105 test_FunctionDeclaration_returnType_afterComment() async { | 1989 test_FunctionDeclaration_returnType_afterComment() async { |
2106 // ClassDeclaration CompilationUnit | 1990 // ClassDeclaration CompilationUnit |
2107 addSource( | 1991 addSource('/testA.dart', ''' |
2108 '/testA.dart', | |
2109 ''' | |
2110 int T1; | 1992 int T1; |
2111 F1() { } | 1993 F1() { } |
2112 typedef D1(); | 1994 typedef D1(); |
2113 class C1 {C1(this.x) { } int x;}'''); | 1995 class C1 {C1(this.x) { } int x;}'''); |
2114 addTestSource(''' | 1996 addTestSource(''' |
2115 import "/testA.dart"; | 1997 import "/testA.dart"; |
2116 int T2; | 1998 int T2; |
2117 F2() { } | 1999 F2() { } |
2118 typedef D2(); | 2000 typedef D2(); |
2119 class C2 { } | 2001 class C2 { } |
2120 /* */ ^ zoo(z) { } String name;'''); | 2002 /* */ ^ zoo(z) { } String name;'''); |
2121 await computeSuggestions(); | 2003 await computeSuggestions(); |
2122 | 2004 |
2123 expect(replacementOffset, completionOffset); | 2005 expect(replacementOffset, completionOffset); |
2124 expect(replacementLength, 0); | 2006 expect(replacementLength, 0); |
2125 assertNotSuggested('Object'); | 2007 assertNotSuggested('Object'); |
2126 assertNotSuggested('T1'); | 2008 assertNotSuggested('T1'); |
2127 assertNotSuggested('F1'); | 2009 assertNotSuggested('F1'); |
2128 assertNotSuggested('D1'); | 2010 assertNotSuggested('D1'); |
2129 assertNotSuggested('C1'); | 2011 assertNotSuggested('C1'); |
2130 assertNotSuggested('T2'); | 2012 assertNotSuggested('T2'); |
2131 assertNotSuggested('F2'); | 2013 assertNotSuggested('F2'); |
2132 assertNotSuggested('D2'); | 2014 assertNotSuggested('D2'); |
2133 assertNotSuggested('C2'); | 2015 assertNotSuggested('C2'); |
2134 assertNotSuggested('name'); | 2016 assertNotSuggested('name'); |
2135 } | 2017 } |
2136 | 2018 |
2137 test_FunctionDeclaration_returnType_afterComment2() async { | 2019 test_FunctionDeclaration_returnType_afterComment2() async { |
2138 // FunctionDeclaration ClassDeclaration CompilationUnit | 2020 // FunctionDeclaration ClassDeclaration CompilationUnit |
2139 addSource( | 2021 addSource('/testA.dart', ''' |
2140 '/testA.dart', | |
2141 ''' | |
2142 int T1; | 2022 int T1; |
2143 F1() { } | 2023 F1() { } |
2144 typedef D1(); | 2024 typedef D1(); |
2145 class C1 {C1(this.x) { } int x;}'''); | 2025 class C1 {C1(this.x) { } int x;}'''); |
2146 addTestSource(''' | 2026 addTestSource(''' |
2147 import "/testA.dart"; | 2027 import "/testA.dart"; |
2148 int T2; | 2028 int T2; |
2149 F2() { } | 2029 F2() { } |
2150 typedef D2(); | 2030 typedef D2(); |
2151 class C2 { } | 2031 class C2 { } |
2152 /** */ ^ zoo(z) { } String name;'''); | 2032 /** */ ^ zoo(z) { } String name;'''); |
2153 await computeSuggestions(); | 2033 await computeSuggestions(); |
2154 | 2034 |
2155 expect(replacementOffset, completionOffset); | 2035 expect(replacementOffset, completionOffset); |
2156 expect(replacementLength, 0); | 2036 expect(replacementLength, 0); |
2157 assertNotSuggested('Object'); | 2037 assertNotSuggested('Object'); |
2158 assertNotSuggested('T1'); | 2038 assertNotSuggested('T1'); |
2159 assertNotSuggested('F1'); | 2039 assertNotSuggested('F1'); |
2160 assertNotSuggested('D1'); | 2040 assertNotSuggested('D1'); |
2161 assertNotSuggested('C1'); | 2041 assertNotSuggested('C1'); |
2162 assertNotSuggested('T2'); | 2042 assertNotSuggested('T2'); |
2163 assertNotSuggested('F2'); | 2043 assertNotSuggested('F2'); |
2164 assertNotSuggested('D2'); | 2044 assertNotSuggested('D2'); |
2165 assertNotSuggested('C2'); | 2045 assertNotSuggested('C2'); |
2166 assertNotSuggested('name'); | 2046 assertNotSuggested('name'); |
2167 } | 2047 } |
2168 | 2048 |
2169 test_FunctionDeclaration_returnType_afterComment3() async { | 2049 test_FunctionDeclaration_returnType_afterComment3() async { |
2170 // FunctionDeclaration ClassDeclaration CompilationUnit | 2050 // FunctionDeclaration ClassDeclaration CompilationUnit |
2171 addSource( | 2051 addSource('/testA.dart', ''' |
2172 '/testA.dart', | |
2173 ''' | |
2174 int T1; | 2052 int T1; |
2175 F1() { } | 2053 F1() { } |
2176 typedef D1(); | 2054 typedef D1(); |
2177 class C1 {C1(this.x) { } int x;}'''); | 2055 class C1 {C1(this.x) { } int x;}'''); |
2178 addTestSource(''' | 2056 addTestSource(''' |
2179 import "/testA.dart"; | 2057 import "/testA.dart"; |
2180 int T2; | 2058 int T2; |
2181 F2() { } | 2059 F2() { } |
2182 typedef D2(); | 2060 typedef D2(); |
2183 /// some dartdoc | 2061 /// some dartdoc |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 test_inDartDoc_reference4() async { | 2196 test_inDartDoc_reference4() async { |
2319 addTestSource(''' | 2197 addTestSource(''' |
2320 /// The [m^] | 2198 /// The [m^] |
2321 main(aaa, bbb) {}'''); | 2199 main(aaa, bbb) {}'''); |
2322 await computeSuggestions(); | 2200 await computeSuggestions(); |
2323 assertNotSuggested('main'); | 2201 assertNotSuggested('main'); |
2324 } | 2202 } |
2325 | 2203 |
2326 test_IndexExpression() async { | 2204 test_IndexExpression() async { |
2327 // ExpressionStatement Block | 2205 // ExpressionStatement Block |
2328 addSource( | 2206 addSource('/testA.dart', ''' |
2329 '/testA.dart', | |
2330 ''' | |
2331 int T1; | 2207 int T1; |
2332 F1() { } | 2208 F1() { } |
2333 class A {int x;}'''); | 2209 class A {int x;}'''); |
2334 addTestSource(''' | 2210 addTestSource(''' |
2335 import "/testA.dart"; | 2211 import "/testA.dart"; |
2336 int T2; | 2212 int T2; |
2337 F2() { } | 2213 F2() { } |
2338 class B {int x;} | 2214 class B {int x;} |
2339 class C {foo(){var f; {var x;} f[^]}}'''); | 2215 class C {foo(){var f; {var x;} f[^]}}'''); |
2340 await computeSuggestions(); | 2216 await computeSuggestions(); |
2341 | 2217 |
2342 assertNotSuggested('x'); | 2218 assertNotSuggested('x'); |
2343 assertNotSuggested('f'); | 2219 assertNotSuggested('f'); |
2344 assertNotSuggested('foo'); | 2220 assertNotSuggested('foo'); |
2345 assertNotSuggested('C'); | 2221 assertNotSuggested('C'); |
2346 assertNotSuggested('F2'); | 2222 assertNotSuggested('F2'); |
2347 assertNotSuggested('T2'); | 2223 assertNotSuggested('T2'); |
2348 assertNotSuggested('A'); | 2224 assertNotSuggested('A'); |
2349 assertNotSuggested('F1'); | 2225 assertNotSuggested('F1'); |
2350 // TODO (danrubel) getter is being suggested instead of top level var | 2226 // TODO (danrubel) getter is being suggested instead of top level var |
2351 //assertNotSuggested('T1'); | 2227 //assertNotSuggested('T1'); |
2352 } | 2228 } |
2353 | 2229 |
2354 test_IndexExpression2() async { | 2230 test_IndexExpression2() async { |
2355 // SimpleIdentifier IndexExpression ExpressionStatement Block | 2231 // SimpleIdentifier IndexExpression ExpressionStatement Block |
2356 addSource( | 2232 addSource('/testA.dart', ''' |
2357 '/testA.dart', | |
2358 ''' | |
2359 int T1; | 2233 int T1; |
2360 F1() { } | 2234 F1() { } |
2361 class A {int x;}'''); | 2235 class A {int x;}'''); |
2362 addTestSource(''' | 2236 addTestSource(''' |
2363 import "/testA.dart"; | 2237 import "/testA.dart"; |
2364 int T2; | 2238 int T2; |
2365 F2() { } | 2239 F2() { } |
2366 class B {int x;} | 2240 class B {int x;} |
2367 class C {foo(){var f; {var x;} f[T^]}}'''); | 2241 class C {foo(){var f; {var x;} f[T^]}}'''); |
2368 await computeSuggestions(); | 2242 await computeSuggestions(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); | 2322 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); |
2449 assertSuggestConstructor('B', | 2323 assertSuggestConstructor('B', |
2450 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); | 2324 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); |
2451 assertSuggestConstructor('C', | 2325 assertSuggestConstructor('C', |
2452 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); | 2326 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); |
2453 assertNotSuggested('D'); | 2327 assertNotSuggested('D'); |
2454 } | 2328 } |
2455 | 2329 |
2456 test_InstanceCreationExpression_imported() async { | 2330 test_InstanceCreationExpression_imported() async { |
2457 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression | 2331 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
2458 addSource( | 2332 addSource('/testA.dart', ''' |
2459 '/testA.dart', | |
2460 ''' | |
2461 int T1; | 2333 int T1; |
2462 F1() { } | 2334 F1() { } |
2463 class A {A(this.x) { } int x;}'''); | 2335 class A {A(this.x) { } int x;}'''); |
2464 addTestSource(''' | 2336 addTestSource(''' |
2465 import "/testA.dart"; | 2337 import "/testA.dart"; |
2466 import "dart:async"; | 2338 import "dart:async"; |
2467 int T2; | 2339 int T2; |
2468 F2() { } | 2340 F2() { } |
2469 class B {B(this.x, [String boo]) { } int x;} | 2341 class B {B(this.x, [String boo]) { } int x;} |
2470 class C {foo(){var f; {var x;} new ^}}'''); | 2342 class C {foo(){var f; {var x;} new ^}}'''); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); | 2401 relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT); |
2530 assertSuggestConstructor('B', | 2402 assertSuggestConstructor('B', |
2531 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); | 2403 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); |
2532 assertSuggestConstructor('C', | 2404 assertSuggestConstructor('C', |
2533 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); | 2405 elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT); |
2534 assertNotSuggested('D'); | 2406 assertNotSuggested('D'); |
2535 } | 2407 } |
2536 | 2408 |
2537 test_InterpolationExpression() async { | 2409 test_InterpolationExpression() async { |
2538 // SimpleIdentifier InterpolationExpression StringInterpolation | 2410 // SimpleIdentifier InterpolationExpression StringInterpolation |
2539 addSource( | 2411 addSource('/testA.dart', ''' |
2540 '/testA.dart', | |
2541 ''' | |
2542 int T1; | 2412 int T1; |
2543 F1() { } | 2413 F1() { } |
2544 typedef D1(); | 2414 typedef D1(); |
2545 class C1 {C1(this.x) { } int x;}'''); | 2415 class C1 {C1(this.x) { } int x;}'''); |
2546 addTestSource(''' | 2416 addTestSource(''' |
2547 import "/testA.dart"; | 2417 import "/testA.dart"; |
2548 int T2; | 2418 int T2; |
2549 F2() { } | 2419 F2() { } |
2550 typedef D2(); | 2420 typedef D2(); |
2551 class C2 { } | 2421 class C2 { } |
2552 main() {String name; print("hello \$^");}'''); | 2422 main() {String name; print("hello \$^");}'''); |
2553 await computeSuggestions(); | 2423 await computeSuggestions(); |
2554 | 2424 |
2555 expect(replacementOffset, completionOffset); | 2425 expect(replacementOffset, completionOffset); |
2556 expect(replacementLength, 0); | 2426 expect(replacementLength, 0); |
2557 assertNotSuggested('Object'); | 2427 assertNotSuggested('Object'); |
2558 assertNotSuggested('T1'); | 2428 assertNotSuggested('T1'); |
2559 assertNotSuggested('F1'); | 2429 assertNotSuggested('F1'); |
2560 assertNotSuggested('D1'); | 2430 assertNotSuggested('D1'); |
2561 assertNotSuggested('C1'); | 2431 assertNotSuggested('C1'); |
2562 assertNotSuggested('T2'); | 2432 assertNotSuggested('T2'); |
2563 assertNotSuggested('F2'); | 2433 assertNotSuggested('F2'); |
2564 assertNotSuggested('D2'); | 2434 assertNotSuggested('D2'); |
2565 assertNotSuggested('C2'); | 2435 assertNotSuggested('C2'); |
2566 assertNotSuggested('name'); | 2436 assertNotSuggested('name'); |
2567 } | 2437 } |
2568 | 2438 |
2569 test_InterpolationExpression_block() async { | 2439 test_InterpolationExpression_block() async { |
2570 // SimpleIdentifier InterpolationExpression StringInterpolation | 2440 // SimpleIdentifier InterpolationExpression StringInterpolation |
2571 addSource( | 2441 addSource('/testA.dart', ''' |
2572 '/testA.dart', | |
2573 ''' | |
2574 int T1; | 2442 int T1; |
2575 F1() { } | 2443 F1() { } |
2576 typedef D1(); | 2444 typedef D1(); |
2577 class C1 {C1(this.x) { } int x;}'''); | 2445 class C1 {C1(this.x) { } int x;}'''); |
2578 addTestSource(''' | 2446 addTestSource(''' |
2579 import "/testA.dart"; | 2447 import "/testA.dart"; |
2580 int T2; | 2448 int T2; |
2581 F2() { } | 2449 F2() { } |
2582 typedef D2(); | 2450 typedef D2(); |
2583 class C2 { } | 2451 class C2 { } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 await computeSuggestions(); | 2503 await computeSuggestions(); |
2636 | 2504 |
2637 assertNotSuggested('name'); | 2505 assertNotSuggested('name'); |
2638 // top level results are partially filtered | 2506 // top level results are partially filtered |
2639 //assertNotSuggested('Object'); | 2507 //assertNotSuggested('Object'); |
2640 assertNotSuggested('length'); | 2508 assertNotSuggested('length'); |
2641 } | 2509 } |
2642 | 2510 |
2643 test_IsExpression() async { | 2511 test_IsExpression() async { |
2644 // SimpleIdentifier TypeName IsExpression IfStatement | 2512 // SimpleIdentifier TypeName IsExpression IfStatement |
2645 addSource( | 2513 addSource('/testB.dart', ''' |
2646 '/testB.dart', | |
2647 ''' | |
2648 lib B; | 2514 lib B; |
2649 foo() { } | 2515 foo() { } |
2650 class X {X.c(); X._d(); z() {}}'''); | 2516 class X {X.c(); X._d(); z() {}}'''); |
2651 addTestSource(''' | 2517 addTestSource(''' |
2652 import "/testB.dart"; | 2518 import "/testB.dart"; |
2653 class Y {Y.c(); Y._d(); z() {}} | 2519 class Y {Y.c(); Y._d(); z() {}} |
2654 main() {var x; if (x is ^) { }}'''); | 2520 main() {var x; if (x is ^) { }}'''); |
2655 await computeSuggestions(); | 2521 await computeSuggestions(); |
2656 | 2522 |
2657 expect(replacementOffset, completionOffset); | 2523 expect(replacementOffset, completionOffset); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 | 2572 |
2707 expect(replacementOffset, completionOffset - 3); | 2573 expect(replacementOffset, completionOffset - 3); |
2708 expect(replacementLength, 3); | 2574 expect(replacementLength, 3); |
2709 assertNotSuggested('a'); | 2575 assertNotSuggested('a'); |
2710 assertNotSuggested('main'); | 2576 assertNotSuggested('main'); |
2711 assertNotSuggested('A'); | 2577 assertNotSuggested('A'); |
2712 assertNotSuggested('Object'); | 2578 assertNotSuggested('Object'); |
2713 } | 2579 } |
2714 | 2580 |
2715 test_keyword() async { | 2581 test_keyword() async { |
2716 addSource( | 2582 addSource('/testB.dart', ''' |
2717 '/testB.dart', | |
2718 ''' | |
2719 lib B; | 2583 lib B; |
2720 int newT1; | 2584 int newT1; |
2721 int T1; | 2585 int T1; |
2722 nowIsIt() { } | 2586 nowIsIt() { } |
2723 class X {factory X.c(); factory X._d(); z() {}}'''); | 2587 class X {factory X.c(); factory X._d(); z() {}}'''); |
2724 addTestSource(''' | 2588 addTestSource(''' |
2725 import "/testB.dart"; | 2589 import "/testB.dart"; |
2726 String newer() {} | 2590 String newer() {} |
2727 var m; | 2591 var m; |
2728 main() {new^ X.c();}'''); | 2592 main() {new^ X.c();}'''); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2770 test_localVariableDeclarationName() async { | 2634 test_localVariableDeclarationName() async { |
2771 addTestSource('main() {String m^}'); | 2635 addTestSource('main() {String m^}'); |
2772 await computeSuggestions(); | 2636 await computeSuggestions(); |
2773 | 2637 |
2774 assertNotSuggested('main'); | 2638 assertNotSuggested('main'); |
2775 assertNotSuggested('min'); | 2639 assertNotSuggested('min'); |
2776 } | 2640 } |
2777 | 2641 |
2778 test_MapLiteralEntry() async { | 2642 test_MapLiteralEntry() async { |
2779 // MapLiteralEntry MapLiteral VariableDeclaration | 2643 // MapLiteralEntry MapLiteral VariableDeclaration |
2780 addSource( | 2644 addSource('/testA.dart', ''' |
2781 '/testA.dart', | |
2782 ''' | |
2783 int T1; | 2645 int T1; |
2784 F1() { } | 2646 F1() { } |
2785 typedef D1(); | 2647 typedef D1(); |
2786 class C1 {C1(this.x) { } int x;}'''); | 2648 class C1 {C1(this.x) { } int x;}'''); |
2787 addTestSource(''' | 2649 addTestSource(''' |
2788 import "/testA.dart"; | 2650 import "/testA.dart"; |
2789 int T2; | 2651 int T2; |
2790 F2() { } | 2652 F2() { } |
2791 typedef D2(); | 2653 typedef D2(); |
2792 class C2 { } | 2654 class C2 { } |
2793 foo = {^'''); | 2655 foo = {^'''); |
2794 await computeSuggestions(); | 2656 await computeSuggestions(); |
2795 | 2657 |
2796 expect(replacementOffset, completionOffset); | 2658 expect(replacementOffset, completionOffset); |
2797 expect(replacementLength, 0); | 2659 expect(replacementLength, 0); |
2798 assertNotSuggested('Object'); | 2660 assertNotSuggested('Object'); |
2799 assertNotSuggested('T1'); | 2661 assertNotSuggested('T1'); |
2800 assertNotSuggested('F1'); | 2662 assertNotSuggested('F1'); |
2801 assertNotSuggested('D1'); | 2663 assertNotSuggested('D1'); |
2802 assertNotSuggested('C1'); | 2664 assertNotSuggested('C1'); |
2803 assertNotSuggested('T2'); | 2665 assertNotSuggested('T2'); |
2804 assertNotSuggested('F2'); | 2666 assertNotSuggested('F2'); |
2805 assertNotSuggested('D2'); | 2667 assertNotSuggested('D2'); |
2806 assertNotSuggested('C2'); | 2668 assertNotSuggested('C2'); |
2807 } | 2669 } |
2808 | 2670 |
2809 test_MapLiteralEntry1() async { | 2671 test_MapLiteralEntry1() async { |
2810 // MapLiteralEntry MapLiteral VariableDeclaration | 2672 // MapLiteralEntry MapLiteral VariableDeclaration |
2811 addSource( | 2673 addSource('/testA.dart', ''' |
2812 '/testA.dart', | |
2813 ''' | |
2814 int T1; | 2674 int T1; |
2815 F1() { } | 2675 F1() { } |
2816 typedef D1(); | 2676 typedef D1(); |
2817 class C1 {C1(this.x) { } int x;}'''); | 2677 class C1 {C1(this.x) { } int x;}'''); |
2818 addTestSource(''' | 2678 addTestSource(''' |
2819 import "/testA.dart"; | 2679 import "/testA.dart"; |
2820 int T2; | 2680 int T2; |
2821 F2() { } | 2681 F2() { } |
2822 typedef D2(); | 2682 typedef D2(); |
2823 class C2 { } | 2683 class C2 { } |
2824 foo = {T^'''); | 2684 foo = {T^'''); |
2825 await computeSuggestions(); | 2685 await computeSuggestions(); |
2826 | 2686 |
2827 expect(replacementOffset, completionOffset - 1); | 2687 expect(replacementOffset, completionOffset - 1); |
2828 expect(replacementLength, 1); | 2688 expect(replacementLength, 1); |
2829 assertNotSuggested('T1'); | 2689 assertNotSuggested('T1'); |
2830 assertNotSuggested('T2'); | 2690 assertNotSuggested('T2'); |
2831 } | 2691 } |
2832 | 2692 |
2833 test_MapLiteralEntry2() async { | 2693 test_MapLiteralEntry2() async { |
2834 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration | 2694 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration |
2835 addSource( | 2695 addSource('/testA.dart', ''' |
2836 '/testA.dart', | |
2837 ''' | |
2838 int T1; | 2696 int T1; |
2839 F1() { } | 2697 F1() { } |
2840 typedef D1(); | 2698 typedef D1(); |
2841 class C1 {C1(this.x) { } int x;}'''); | 2699 class C1 {C1(this.x) { } int x;}'''); |
2842 addTestSource(''' | 2700 addTestSource(''' |
2843 import "/testA.dart"; | 2701 import "/testA.dart"; |
2844 int T2; | 2702 int T2; |
2845 F2() { } | 2703 F2() { } |
2846 typedef D2(); | 2704 typedef D2(); |
2847 class C2 { } | 2705 class C2 { } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 | 2797 |
2940 expect(replacementOffset, completionOffset); | 2798 expect(replacementOffset, completionOffset); |
2941 expect(replacementLength, 0); | 2799 expect(replacementLength, 0); |
2942 assertNotSuggested('a'); | 2800 assertNotSuggested('a'); |
2943 assertNotSuggested('f'); | 2801 assertNotSuggested('f'); |
2944 assertNotSuggested('_g'); | 2802 assertNotSuggested('_g'); |
2945 } | 2803 } |
2946 | 2804 |
2947 test_MethodDeclaration_body_static() async { | 2805 test_MethodDeclaration_body_static() async { |
2948 // Block BlockFunctionBody MethodDeclaration | 2806 // Block BlockFunctionBody MethodDeclaration |
2949 addSource( | 2807 addSource('/testC.dart', ''' |
2950 '/testC.dart', | |
2951 ''' | |
2952 class C { | 2808 class C { |
2953 c1() {} | 2809 c1() {} |
2954 var c2; | 2810 var c2; |
2955 static c3() {} | 2811 static c3() {} |
2956 static var c4;}'''); | 2812 static var c4;}'''); |
2957 addTestSource(''' | 2813 addTestSource(''' |
2958 import "/testC.dart"; | 2814 import "/testC.dart"; |
2959 class B extends C { | 2815 class B extends C { |
2960 b1() {} | 2816 b1() {} |
2961 var b2; | 2817 var b2; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 assertNotSuggested('foo'); | 2881 assertNotSuggested('foo'); |
3026 assertNotSuggested('bar'); | 2882 assertNotSuggested('bar'); |
3027 assertNotSuggested('a'); | 2883 assertNotSuggested('a'); |
3028 assertNotSuggested('x'); | 2884 assertNotSuggested('x'); |
3029 assertNotSuggested('y'); | 2885 assertNotSuggested('y'); |
3030 assertNotSuggested('String'); | 2886 assertNotSuggested('String'); |
3031 } | 2887 } |
3032 | 2888 |
3033 test_MethodDeclaration_returnType() async { | 2889 test_MethodDeclaration_returnType() async { |
3034 // ClassDeclaration CompilationUnit | 2890 // ClassDeclaration CompilationUnit |
3035 addSource( | 2891 addSource('/testA.dart', ''' |
3036 '/testA.dart', | |
3037 ''' | |
3038 int T1; | 2892 int T1; |
3039 F1() { } | 2893 F1() { } |
3040 typedef D1(); | 2894 typedef D1(); |
3041 class C1 {C1(this.x) { } int x;}'''); | 2895 class C1 {C1(this.x) { } int x;}'''); |
3042 addTestSource(''' | 2896 addTestSource(''' |
3043 import "/testA.dart"; | 2897 import "/testA.dart"; |
3044 int T2; | 2898 int T2; |
3045 F2() { } | 2899 F2() { } |
3046 typedef D2(); | 2900 typedef D2(); |
3047 class C2 {^ zoo(z) { } String name; }'''); | 2901 class C2 {^ zoo(z) { } String name; }'''); |
3048 await computeSuggestions(); | 2902 await computeSuggestions(); |
3049 | 2903 |
3050 expect(replacementOffset, completionOffset); | 2904 expect(replacementOffset, completionOffset); |
3051 expect(replacementLength, 0); | 2905 expect(replacementLength, 0); |
3052 assertNotSuggested('Object'); | 2906 assertNotSuggested('Object'); |
3053 assertNotSuggested('T1'); | 2907 assertNotSuggested('T1'); |
3054 assertNotSuggested('F1'); | 2908 assertNotSuggested('F1'); |
3055 assertNotSuggested('D1'); | 2909 assertNotSuggested('D1'); |
3056 assertNotSuggested('C1'); | 2910 assertNotSuggested('C1'); |
3057 assertNotSuggested('T2'); | 2911 assertNotSuggested('T2'); |
3058 assertNotSuggested('F2'); | 2912 assertNotSuggested('F2'); |
3059 assertNotSuggested('D2'); | 2913 assertNotSuggested('D2'); |
3060 assertNotSuggested('C2'); | 2914 assertNotSuggested('C2'); |
3061 assertNotSuggested('name'); | 2915 assertNotSuggested('name'); |
3062 } | 2916 } |
3063 | 2917 |
3064 test_MethodDeclaration_returnType_afterComment() async { | 2918 test_MethodDeclaration_returnType_afterComment() async { |
3065 // ClassDeclaration CompilationUnit | 2919 // ClassDeclaration CompilationUnit |
3066 addSource( | 2920 addSource('/testA.dart', ''' |
3067 '/testA.dart', | |
3068 ''' | |
3069 int T1; | 2921 int T1; |
3070 F1() { } | 2922 F1() { } |
3071 typedef D1(); | 2923 typedef D1(); |
3072 class C1 {C1(this.x) { } int x;}'''); | 2924 class C1 {C1(this.x) { } int x;}'''); |
3073 addTestSource(''' | 2925 addTestSource(''' |
3074 import "/testA.dart"; | 2926 import "/testA.dart"; |
3075 int T2; | 2927 int T2; |
3076 F2() { } | 2928 F2() { } |
3077 typedef D2(); | 2929 typedef D2(); |
3078 class C2 {/* */ ^ zoo(z) { } String name; }'''); | 2930 class C2 {/* */ ^ zoo(z) { } String name; }'''); |
3079 await computeSuggestions(); | 2931 await computeSuggestions(); |
3080 | 2932 |
3081 expect(replacementOffset, completionOffset); | 2933 expect(replacementOffset, completionOffset); |
3082 expect(replacementLength, 0); | 2934 expect(replacementLength, 0); |
3083 assertNotSuggested('Object'); | 2935 assertNotSuggested('Object'); |
3084 assertNotSuggested('T1'); | 2936 assertNotSuggested('T1'); |
3085 assertNotSuggested('F1'); | 2937 assertNotSuggested('F1'); |
3086 assertNotSuggested('D1'); | 2938 assertNotSuggested('D1'); |
3087 assertNotSuggested('C1'); | 2939 assertNotSuggested('C1'); |
3088 assertNotSuggested('T2'); | 2940 assertNotSuggested('T2'); |
3089 assertNotSuggested('F2'); | 2941 assertNotSuggested('F2'); |
3090 assertNotSuggested('D2'); | 2942 assertNotSuggested('D2'); |
3091 assertNotSuggested('C2'); | 2943 assertNotSuggested('C2'); |
3092 assertNotSuggested('name'); | 2944 assertNotSuggested('name'); |
3093 } | 2945 } |
3094 | 2946 |
3095 test_MethodDeclaration_returnType_afterComment2() async { | 2947 test_MethodDeclaration_returnType_afterComment2() async { |
3096 // MethodDeclaration ClassDeclaration CompilationUnit | 2948 // MethodDeclaration ClassDeclaration CompilationUnit |
3097 addSource( | 2949 addSource('/testA.dart', ''' |
3098 '/testA.dart', | |
3099 ''' | |
3100 int T1; | 2950 int T1; |
3101 F1() { } | 2951 F1() { } |
3102 typedef D1(); | 2952 typedef D1(); |
3103 class C1 {C1(this.x) { } int x;}'''); | 2953 class C1 {C1(this.x) { } int x;}'''); |
3104 addTestSource(''' | 2954 addTestSource(''' |
3105 import "/testA.dart"; | 2955 import "/testA.dart"; |
3106 int T2; | 2956 int T2; |
3107 F2() { } | 2957 F2() { } |
3108 typedef D2(); | 2958 typedef D2(); |
3109 class C2 {/** */ ^ zoo(z) { } String name; }'''); | 2959 class C2 {/** */ ^ zoo(z) { } String name; }'''); |
3110 await computeSuggestions(); | 2960 await computeSuggestions(); |
3111 | 2961 |
3112 expect(replacementOffset, completionOffset); | 2962 expect(replacementOffset, completionOffset); |
3113 expect(replacementLength, 0); | 2963 expect(replacementLength, 0); |
3114 assertNotSuggested('Object'); | 2964 assertNotSuggested('Object'); |
3115 assertNotSuggested('T1'); | 2965 assertNotSuggested('T1'); |
3116 assertNotSuggested('F1'); | 2966 assertNotSuggested('F1'); |
3117 assertNotSuggested('D1'); | 2967 assertNotSuggested('D1'); |
3118 assertNotSuggested('C1'); | 2968 assertNotSuggested('C1'); |
3119 assertNotSuggested('T2'); | 2969 assertNotSuggested('T2'); |
3120 assertNotSuggested('F2'); | 2970 assertNotSuggested('F2'); |
3121 assertNotSuggested('D2'); | 2971 assertNotSuggested('D2'); |
3122 assertNotSuggested('C2'); | 2972 assertNotSuggested('C2'); |
3123 assertNotSuggested('name'); | 2973 assertNotSuggested('name'); |
3124 } | 2974 } |
3125 | 2975 |
3126 test_MethodDeclaration_returnType_afterComment3() async { | 2976 test_MethodDeclaration_returnType_afterComment3() async { |
3127 // MethodDeclaration ClassDeclaration CompilationUnit | 2977 // MethodDeclaration ClassDeclaration CompilationUnit |
3128 addSource( | 2978 addSource('/testA.dart', ''' |
3129 '/testA.dart', | |
3130 ''' | |
3131 int T1; | 2979 int T1; |
3132 F1() { } | 2980 F1() { } |
3133 typedef D1(); | 2981 typedef D1(); |
3134 class C1 {C1(this.x) { } int x;}'''); | 2982 class C1 {C1(this.x) { } int x;}'''); |
3135 addTestSource(''' | 2983 addTestSource(''' |
3136 import "/testA.dart"; | 2984 import "/testA.dart"; |
3137 int T2; | 2985 int T2; |
3138 F2() { } | 2986 F2() { } |
3139 typedef D2(); | 2987 typedef D2(); |
3140 class C2 { | 2988 class C2 { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3228 test_parameterName_excludeTypes() async { | 3076 test_parameterName_excludeTypes() async { |
3229 addTestSource('m(int ^) {}'); | 3077 addTestSource('m(int ^) {}'); |
3230 await computeSuggestions(); | 3078 await computeSuggestions(); |
3231 | 3079 |
3232 assertNotSuggested('int'); | 3080 assertNotSuggested('int'); |
3233 assertNotSuggested('bool'); | 3081 assertNotSuggested('bool'); |
3234 } | 3082 } |
3235 | 3083 |
3236 test_partFile_TypeName() async { | 3084 test_partFile_TypeName() async { |
3237 // SimpleIdentifier TypeName ConstructorName | 3085 // SimpleIdentifier TypeName ConstructorName |
3238 addSource( | 3086 addSource('/testB.dart', ''' |
3239 '/testB.dart', | |
3240 ''' | |
3241 lib B; | 3087 lib B; |
3242 int T1; | 3088 int T1; |
3243 F1() { } | 3089 F1() { } |
3244 class X {X.c(); X._d(); z() {}}'''); | 3090 class X {X.c(); X._d(); z() {}}'''); |
3245 addSource( | 3091 addSource('/testA.dart', ''' |
3246 '/testA.dart', | |
3247 ''' | |
3248 library libA; | 3092 library libA; |
3249 import "/testB.dart"; | 3093 import "/testB.dart"; |
3250 part "$testFile"; | 3094 part "$testFile"; |
3251 class A { } | 3095 class A { } |
3252 var m;'''); | 3096 var m;'''); |
3253 addTestSource(''' | 3097 addTestSource(''' |
3254 part of libA; | 3098 part of libA; |
3255 class B { factory B.bar(int x) => null; } | 3099 class B { factory B.bar(int x) => null; } |
3256 main() {new ^}'''); | 3100 main() {new ^}'''); |
3257 await computeLibrariesContaining(); | 3101 await computeLibrariesContaining(); |
3258 await computeSuggestions(); | 3102 await computeSuggestions(); |
3259 | 3103 |
3260 expect(replacementOffset, completionOffset); | 3104 expect(replacementOffset, completionOffset); |
3261 expect(replacementLength, 0); | 3105 expect(replacementLength, 0); |
3262 assertSuggestConstructor('B.bar'); | 3106 assertSuggestConstructor('B.bar'); |
3263 assertNotSuggested('Object'); | 3107 assertNotSuggested('Object'); |
3264 assertNotSuggested('X.c'); | 3108 assertNotSuggested('X.c'); |
3265 assertNotSuggested('X._d'); | 3109 assertNotSuggested('X._d'); |
3266 assertNotSuggested('A'); | 3110 assertNotSuggested('A'); |
3267 assertNotSuggested('F1'); | 3111 assertNotSuggested('F1'); |
3268 assertNotSuggested('T1'); | 3112 assertNotSuggested('T1'); |
3269 assertNotSuggested('_d'); | 3113 assertNotSuggested('_d'); |
3270 assertNotSuggested('z'); | 3114 assertNotSuggested('z'); |
3271 assertNotSuggested('m'); | 3115 assertNotSuggested('m'); |
3272 } | 3116 } |
3273 | 3117 |
3274 test_partFile_TypeName2() async { | 3118 test_partFile_TypeName2() async { |
3275 // SimpleIdentifier TypeName ConstructorName | 3119 // SimpleIdentifier TypeName ConstructorName |
3276 addSource( | 3120 addSource('/testB.dart', ''' |
3277 '/testB.dart', | |
3278 ''' | |
3279 lib B; | 3121 lib B; |
3280 int T1; | 3122 int T1; |
3281 F1() { } | 3123 F1() { } |
3282 class X {X.c(); X._d(); z() {}}'''); | 3124 class X {X.c(); X._d(); z() {}}'''); |
3283 addSource( | 3125 addSource('/testA.dart', ''' |
3284 '/testA.dart', | |
3285 ''' | |
3286 part of libA; | 3126 part of libA; |
3287 class B { }'''); | 3127 class B { }'''); |
3288 addTestSource(''' | 3128 addTestSource(''' |
3289 library libA; | 3129 library libA; |
3290 import "/testB.dart"; | 3130 import "/testB.dart"; |
3291 part "/testA.dart"; | 3131 part "/testA.dart"; |
3292 class A { A({String boo: 'hoo'}) { } } | 3132 class A { A({String boo: 'hoo'}) { } } |
3293 main() {new ^} | 3133 main() {new ^} |
3294 var m;'''); | 3134 var m;'''); |
3295 await computeSuggestions(); | 3135 await computeSuggestions(); |
3296 | 3136 |
3297 expect(replacementOffset, completionOffset); | 3137 expect(replacementOffset, completionOffset); |
3298 expect(replacementLength, 0); | 3138 expect(replacementLength, 0); |
3299 assertSuggestConstructor('A'); | 3139 assertSuggestConstructor('A'); |
3300 assertNotSuggested('Object'); | 3140 assertNotSuggested('Object'); |
3301 assertNotSuggested('X.c'); | 3141 assertNotSuggested('X.c'); |
3302 assertNotSuggested('X._d'); | 3142 assertNotSuggested('X._d'); |
3303 assertNotSuggested('B'); | 3143 assertNotSuggested('B'); |
3304 assertNotSuggested('F1'); | 3144 assertNotSuggested('F1'); |
3305 assertNotSuggested('T1'); | 3145 assertNotSuggested('T1'); |
3306 assertNotSuggested('_d'); | 3146 assertNotSuggested('_d'); |
3307 assertNotSuggested('z'); | 3147 assertNotSuggested('z'); |
3308 assertNotSuggested('m'); | 3148 assertNotSuggested('m'); |
3309 } | 3149 } |
3310 | 3150 |
3311 test_PrefixedIdentifier_class_const() async { | 3151 test_PrefixedIdentifier_class_const() async { |
3312 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block | 3152 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block |
3313 addSource( | 3153 addSource('/testB.dart', ''' |
3314 '/testB.dart', | |
3315 ''' | |
3316 lib B; | 3154 lib B; |
3317 class I { | 3155 class I { |
3318 static const scI = 'boo'; | 3156 static const scI = 'boo'; |
3319 X get f => new A(); | 3157 X get f => new A(); |
3320 get _g => new A();} | 3158 get _g => new A();} |
3321 class B implements I { | 3159 class B implements I { |
3322 static const int scB = 12; | 3160 static const int scB = 12; |
3323 var b; X _c; | 3161 var b; X _c; |
3324 X get d => new A();get _e => new A(); | 3162 X get d => new A();get _e => new A(); |
3325 set s1(I x) {} set _s2(I x) {} | 3163 set s1(I x) {} set _s2(I x) {} |
(...skipping 26 matching lines...) Expand all Loading... |
3352 assertNotSuggested('a'); | 3190 assertNotSuggested('a'); |
3353 assertNotSuggested('A'); | 3191 assertNotSuggested('A'); |
3354 assertNotSuggested('X'); | 3192 assertNotSuggested('X'); |
3355 assertNotSuggested('w'); | 3193 assertNotSuggested('w'); |
3356 assertNotSuggested('Object'); | 3194 assertNotSuggested('Object'); |
3357 assertNotSuggested('=='); | 3195 assertNotSuggested('=='); |
3358 } | 3196 } |
3359 | 3197 |
3360 test_PrefixedIdentifier_class_imported() async { | 3198 test_PrefixedIdentifier_class_imported() async { |
3361 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3199 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3362 addSource( | 3200 addSource('/testB.dart', ''' |
3363 '/testB.dart', | |
3364 ''' | |
3365 lib B; | 3201 lib B; |
3366 class I {X get f => new A();get _g => new A();} | 3202 class I {X get f => new A();get _g => new A();} |
3367 class A implements I { | 3203 class A implements I { |
3368 static const int sc = 12; | 3204 static const int sc = 12; |
3369 @deprecated var b; X _c; | 3205 @deprecated var b; X _c; |
3370 X get d => new A();get _e => new A(); | 3206 X get d => new A();get _e => new A(); |
3371 set s1(I x) {} set _s2(I x) {} | 3207 set s1(I x) {} set _s2(I x) {} |
3372 m(X x) {} I _n(X x) {}} | 3208 m(X x) {} I _n(X x) {}} |
3373 class X{}'''); | 3209 class X{}'''); |
3374 addTestSource(''' | 3210 addTestSource(''' |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3433 test_PrefixedIdentifier_getter() async { | 3269 test_PrefixedIdentifier_getter() async { |
3434 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3270 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3435 addTestSource('String get g => "one"; f() {g.^}'); | 3271 addTestSource('String get g => "one"; f() {g.^}'); |
3436 await computeSuggestions(); | 3272 await computeSuggestions(); |
3437 | 3273 |
3438 assertNotSuggested('length'); | 3274 assertNotSuggested('length'); |
3439 } | 3275 } |
3440 | 3276 |
3441 test_PrefixedIdentifier_library() async { | 3277 test_PrefixedIdentifier_library() async { |
3442 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3278 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3443 addSource( | 3279 addSource('/testB.dart', ''' |
3444 '/testB.dart', | |
3445 ''' | |
3446 lib B; | 3280 lib B; |
3447 var T1; | 3281 var T1; |
3448 class X { } | 3282 class X { } |
3449 class Y { }'''); | 3283 class Y { }'''); |
3450 addTestSource(''' | 3284 addTestSource(''' |
3451 import "/testB.dart" as b; | 3285 import "/testB.dart" as b; |
3452 var T2; | 3286 var T2; |
3453 class A { } | 3287 class A { } |
3454 main() {b.^}'''); | 3288 main() {b.^}'''); |
3455 await computeSuggestions(); | 3289 await computeSuggestions(); |
3456 | 3290 |
3457 expect(replacementOffset, completionOffset); | 3291 expect(replacementOffset, completionOffset); |
3458 expect(replacementLength, 0); | 3292 expect(replacementLength, 0); |
3459 // Suggested by LibraryMemberContributor | 3293 // Suggested by LibraryMemberContributor |
3460 assertNotSuggested('X'); | 3294 assertNotSuggested('X'); |
3461 assertNotSuggested('Y'); | 3295 assertNotSuggested('Y'); |
3462 assertNotSuggested('T1'); | 3296 assertNotSuggested('T1'); |
3463 assertNotSuggested('T2'); | 3297 assertNotSuggested('T2'); |
3464 assertNotSuggested('Object'); | 3298 assertNotSuggested('Object'); |
3465 assertNotSuggested('b'); | 3299 assertNotSuggested('b'); |
3466 assertNotSuggested('A'); | 3300 assertNotSuggested('A'); |
3467 assertNotSuggested('=='); | 3301 assertNotSuggested('=='); |
3468 } | 3302 } |
3469 | 3303 |
3470 test_PrefixedIdentifier_library_typesOnly() async { | 3304 test_PrefixedIdentifier_library_typesOnly() async { |
3471 // SimpleIdentifier PrefixedIdentifier TypeName | 3305 // SimpleIdentifier PrefixedIdentifier TypeName |
3472 addSource( | 3306 addSource('/testB.dart', ''' |
3473 '/testB.dart', | |
3474 ''' | |
3475 lib B; | 3307 lib B; |
3476 var T1; | 3308 var T1; |
3477 class X { } | 3309 class X { } |
3478 class Y { }'''); | 3310 class Y { }'''); |
3479 addTestSource(''' | 3311 addTestSource(''' |
3480 import "/testB.dart" as b; | 3312 import "/testB.dart" as b; |
3481 var T2; | 3313 var T2; |
3482 class A { } | 3314 class A { } |
3483 foo(b.^ f) {}'''); | 3315 foo(b.^ f) {}'''); |
3484 await computeSuggestions(); | 3316 await computeSuggestions(); |
3485 | 3317 |
3486 expect(replacementOffset, completionOffset); | 3318 expect(replacementOffset, completionOffset); |
3487 expect(replacementLength, 0); | 3319 expect(replacementLength, 0); |
3488 // Suggested by LibraryMemberContributor | 3320 // Suggested by LibraryMemberContributor |
3489 assertNotSuggested('X'); | 3321 assertNotSuggested('X'); |
3490 assertNotSuggested('Y'); | 3322 assertNotSuggested('Y'); |
3491 assertNotSuggested('T1'); | 3323 assertNotSuggested('T1'); |
3492 assertNotSuggested('T2'); | 3324 assertNotSuggested('T2'); |
3493 assertNotSuggested('Object'); | 3325 assertNotSuggested('Object'); |
3494 assertNotSuggested('b'); | 3326 assertNotSuggested('b'); |
3495 assertNotSuggested('A'); | 3327 assertNotSuggested('A'); |
3496 assertNotSuggested('=='); | 3328 assertNotSuggested('=='); |
3497 } | 3329 } |
3498 | 3330 |
3499 test_PrefixedIdentifier_library_typesOnly2() async { | 3331 test_PrefixedIdentifier_library_typesOnly2() async { |
3500 // SimpleIdentifier PrefixedIdentifier TypeName | 3332 // SimpleIdentifier PrefixedIdentifier TypeName |
3501 addSource( | 3333 addSource('/testB.dart', ''' |
3502 '/testB.dart', | |
3503 ''' | |
3504 lib B; | 3334 lib B; |
3505 var T1; | 3335 var T1; |
3506 class X { } | 3336 class X { } |
3507 class Y { }'''); | 3337 class Y { }'''); |
3508 addTestSource(''' | 3338 addTestSource(''' |
3509 import "/testB.dart" as b; | 3339 import "/testB.dart" as b; |
3510 var T2; | 3340 var T2; |
3511 class A { } | 3341 class A { } |
3512 foo(b.^) {}'''); | 3342 foo(b.^) {}'''); |
3513 await computeSuggestions(); | 3343 await computeSuggestions(); |
3514 | 3344 |
3515 expect(replacementOffset, completionOffset); | 3345 expect(replacementOffset, completionOffset); |
3516 expect(replacementLength, 0); | 3346 expect(replacementLength, 0); |
3517 // Suggested by LibraryMemberContributor | 3347 // Suggested by LibraryMemberContributor |
3518 assertNotSuggested('X'); | 3348 assertNotSuggested('X'); |
3519 assertNotSuggested('Y'); | 3349 assertNotSuggested('Y'); |
3520 assertNotSuggested('T1'); | 3350 assertNotSuggested('T1'); |
3521 assertNotSuggested('T2'); | 3351 assertNotSuggested('T2'); |
3522 assertNotSuggested('Object'); | 3352 assertNotSuggested('Object'); |
3523 assertNotSuggested('b'); | 3353 assertNotSuggested('b'); |
3524 assertNotSuggested('A'); | 3354 assertNotSuggested('A'); |
3525 assertNotSuggested('=='); | 3355 assertNotSuggested('=='); |
3526 } | 3356 } |
3527 | 3357 |
3528 test_PrefixedIdentifier_parameter() async { | 3358 test_PrefixedIdentifier_parameter() async { |
3529 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3359 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3530 addSource( | 3360 addSource('/testB.dart', ''' |
3531 '/testB.dart', | |
3532 ''' | |
3533 lib B; | 3361 lib B; |
3534 class _W {M y; var _z;} | 3362 class _W {M y; var _z;} |
3535 class X extends _W {} | 3363 class X extends _W {} |
3536 class M{}'''); | 3364 class M{}'''); |
3537 addTestSource(''' | 3365 addTestSource(''' |
3538 import "/testB.dart"; | 3366 import "/testB.dart"; |
3539 foo(X x) {x.^}'''); | 3367 foo(X x) {x.^}'''); |
3540 await computeSuggestions(); | 3368 await computeSuggestions(); |
3541 | 3369 |
3542 expect(replacementOffset, completionOffset); | 3370 expect(replacementOffset, completionOffset); |
3543 expect(replacementLength, 0); | 3371 expect(replacementLength, 0); |
3544 assertNotSuggested('y'); | 3372 assertNotSuggested('y'); |
3545 assertNotSuggested('_z'); | 3373 assertNotSuggested('_z'); |
3546 assertNotSuggested('=='); | 3374 assertNotSuggested('=='); |
3547 } | 3375 } |
3548 | 3376 |
3549 test_PrefixedIdentifier_prefix() async { | 3377 test_PrefixedIdentifier_prefix() async { |
3550 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 3378 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
3551 addSource( | 3379 addSource('/testA.dart', ''' |
3552 '/testA.dart', | |
3553 ''' | |
3554 class A {static int bar = 10;} | 3380 class A {static int bar = 10;} |
3555 _B() {}'''); | 3381 _B() {}'''); |
3556 addTestSource(''' | 3382 addTestSource(''' |
3557 import "/testA.dart"; | 3383 import "/testA.dart"; |
3558 class X {foo(){A^.bar}}'''); | 3384 class X {foo(){A^.bar}}'''); |
3559 await computeSuggestions(); | 3385 await computeSuggestions(); |
3560 | 3386 |
3561 expect(replacementOffset, completionOffset - 1); | 3387 expect(replacementOffset, completionOffset - 1); |
3562 expect(replacementLength, 1); | 3388 expect(replacementLength, 1); |
3563 assertNotSuggested('A'); | 3389 assertNotSuggested('A'); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4011 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3837 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4012 // TopLevelVariableDeclaration | 3838 // TopLevelVariableDeclaration |
4013 addTestSource('class A {} var ^'); | 3839 addTestSource('class A {} var ^'); |
4014 await computeSuggestions(); | 3840 await computeSuggestions(); |
4015 | 3841 |
4016 assertNoSuggestions(); | 3842 assertNoSuggestions(); |
4017 } | 3843 } |
4018 | 3844 |
4019 test_TypeArgumentList() async { | 3845 test_TypeArgumentList() async { |
4020 // SimpleIdentifier BinaryExpression ExpressionStatement | 3846 // SimpleIdentifier BinaryExpression ExpressionStatement |
4021 addSource( | 3847 addSource('/testA.dart', ''' |
4022 '/testA.dart', | |
4023 ''' | |
4024 class C1 {int x;} | 3848 class C1 {int x;} |
4025 F1() => 0; | 3849 F1() => 0; |
4026 typedef String T1(int blat);'''); | 3850 typedef String T1(int blat);'''); |
4027 addTestSource(''' | 3851 addTestSource(''' |
4028 import "/testA.dart";' | 3852 import "/testA.dart";' |
4029 class C2 {int x;} | 3853 class C2 {int x;} |
4030 F2() => 0; | 3854 F2() => 0; |
4031 typedef int T2(int blat); | 3855 typedef int T2(int blat); |
4032 class C<E> {} | 3856 class C<E> {} |
4033 main() { C<^> c; }'''); | 3857 main() { C<^> c; }'''); |
4034 await computeSuggestions(); | 3858 await computeSuggestions(); |
4035 | 3859 |
4036 expect(replacementOffset, completionOffset); | 3860 expect(replacementOffset, completionOffset); |
4037 expect(replacementLength, 0); | 3861 expect(replacementLength, 0); |
4038 assertNotSuggested('Object'); | 3862 assertNotSuggested('Object'); |
4039 assertNotSuggested('C1'); | 3863 assertNotSuggested('C1'); |
4040 assertNotSuggested('T1'); | 3864 assertNotSuggested('T1'); |
4041 assertNotSuggested('C2'); | 3865 assertNotSuggested('C2'); |
4042 assertNotSuggested('T2'); | 3866 assertNotSuggested('T2'); |
4043 assertNotSuggested('F1'); | 3867 assertNotSuggested('F1'); |
4044 assertNotSuggested('F2'); | 3868 assertNotSuggested('F2'); |
4045 } | 3869 } |
4046 | 3870 |
4047 test_TypeArgumentList2() async { | 3871 test_TypeArgumentList2() async { |
4048 // TypeName TypeArgumentList TypeName | 3872 // TypeName TypeArgumentList TypeName |
4049 addSource( | 3873 addSource('/testA.dart', ''' |
4050 '/testA.dart', | |
4051 ''' | |
4052 class C1 {int x;} | 3874 class C1 {int x;} |
4053 F1() => 0; | 3875 F1() => 0; |
4054 typedef String T1(int blat);'''); | 3876 typedef String T1(int blat);'''); |
4055 addTestSource(''' | 3877 addTestSource(''' |
4056 import "/testA.dart";' | 3878 import "/testA.dart";' |
4057 class C2 {int x;} | 3879 class C2 {int x;} |
4058 F2() => 0; | 3880 F2() => 0; |
4059 typedef int T2(int blat); | 3881 typedef int T2(int blat); |
4060 class C<E> {} | 3882 class C<E> {} |
4061 main() { C<C^> c; }'''); | 3883 main() { C<C^> c; }'''); |
4062 await computeSuggestions(); | 3884 await computeSuggestions(); |
4063 | 3885 |
4064 expect(replacementOffset, completionOffset - 1); | 3886 expect(replacementOffset, completionOffset - 1); |
4065 expect(replacementLength, 1); | 3887 expect(replacementLength, 1); |
4066 assertNotSuggested('C1'); | 3888 assertNotSuggested('C1'); |
4067 assertNotSuggested('C2'); | 3889 assertNotSuggested('C2'); |
4068 } | 3890 } |
4069 | 3891 |
4070 test_VariableDeclaration_name() async { | 3892 test_VariableDeclaration_name() async { |
4071 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3893 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4072 // VariableDeclarationStatement Block | 3894 // VariableDeclarationStatement Block |
4073 addSource( | 3895 addSource('/testB.dart', ''' |
4074 '/testB.dart', | |
4075 ''' | |
4076 lib B; | 3896 lib B; |
4077 foo() { } | 3897 foo() { } |
4078 class _B { } | 3898 class _B { } |
4079 class X {X.c(); X._d(); z() {}}'''); | 3899 class X {X.c(); X._d(); z() {}}'''); |
4080 addTestSource(''' | 3900 addTestSource(''' |
4081 import "/testB.dart"; | 3901 import "/testB.dart"; |
4082 class Y {Y.c(); Y._d(); z() {}} | 3902 class Y {Y.c(); Y._d(); z() {}} |
4083 main() {var ^}'''); | 3903 main() {var ^}'''); |
4084 await computeSuggestions(); | 3904 await computeSuggestions(); |
4085 | 3905 |
4086 assertNoSuggestions(); | 3906 assertNoSuggestions(); |
4087 } | 3907 } |
4088 | 3908 |
4089 test_VariableDeclarationList_final() async { | 3909 test_VariableDeclarationList_final() async { |
4090 // VariableDeclarationList VariableDeclarationStatement Block | 3910 // VariableDeclarationList VariableDeclarationStatement Block |
4091 addTestSource('main() {final ^} class C { }'); | 3911 addTestSource('main() {final ^} class C { }'); |
4092 await computeSuggestions(); | 3912 await computeSuggestions(); |
4093 | 3913 |
4094 assertNotSuggested('Object'); | 3914 assertNotSuggested('Object'); |
4095 assertNotSuggested('C'); | 3915 assertNotSuggested('C'); |
4096 assertNotSuggested('=='); | 3916 assertNotSuggested('=='); |
4097 } | 3917 } |
4098 | 3918 |
4099 test_VariableDeclarationStatement_RHS() async { | 3919 test_VariableDeclarationStatement_RHS() async { |
4100 // SimpleIdentifier VariableDeclaration VariableDeclarationList | 3920 // SimpleIdentifier VariableDeclaration VariableDeclarationList |
4101 // VariableDeclarationStatement | 3921 // VariableDeclarationStatement |
4102 addSource( | 3922 addSource('/testB.dart', ''' |
4103 '/testB.dart', | |
4104 ''' | |
4105 lib B; | 3923 lib B; |
4106 foo() { } | 3924 foo() { } |
4107 class _B { } | 3925 class _B { } |
4108 class X {X.c(); X._d(); z() {}}'''); | 3926 class X {X.c(); X._d(); z() {}}'''); |
4109 addTestSource(''' | 3927 addTestSource(''' |
4110 import "/testB.dart"; | 3928 import "/testB.dart"; |
4111 class Y {Y.c(); Y._d(); z() {}} | 3929 class Y {Y.c(); Y._d(); z() {}} |
4112 class C {bar(){var f; {var x;} var e = ^}}'''); | 3930 class C {bar(){var f; {var x;} var e = ^}}'''); |
4113 await computeSuggestions(); | 3931 await computeSuggestions(); |
4114 | 3932 |
4115 expect(replacementOffset, completionOffset); | 3933 expect(replacementOffset, completionOffset); |
4116 expect(replacementLength, 0); | 3934 expect(replacementLength, 0); |
4117 assertNotSuggested('X'); | 3935 assertNotSuggested('X'); |
4118 assertNotSuggested('_B'); | 3936 assertNotSuggested('_B'); |
4119 assertNotSuggested('Y'); | 3937 assertNotSuggested('Y'); |
4120 assertNotSuggested('C'); | 3938 assertNotSuggested('C'); |
4121 assertNotSuggested('f'); | 3939 assertNotSuggested('f'); |
4122 assertNotSuggested('x'); | 3940 assertNotSuggested('x'); |
4123 assertNotSuggested('e'); | 3941 assertNotSuggested('e'); |
4124 } | 3942 } |
4125 | 3943 |
4126 test_VariableDeclarationStatement_RHS_missing_semicolon() async { | 3944 test_VariableDeclarationStatement_RHS_missing_semicolon() async { |
4127 // VariableDeclaration VariableDeclarationList | 3945 // VariableDeclaration VariableDeclarationList |
4128 // VariableDeclarationStatement | 3946 // VariableDeclarationStatement |
4129 addSource( | 3947 addSource('/testB.dart', ''' |
4130 '/testB.dart', | |
4131 ''' | |
4132 lib B; | 3948 lib B; |
4133 foo1() { } | 3949 foo1() { } |
4134 void bar1() { } | 3950 void bar1() { } |
4135 class _B { } | 3951 class _B { } |
4136 class X {X.c(); X._d(); z() {}}'''); | 3952 class X {X.c(); X._d(); z() {}}'''); |
4137 addTestSource(''' | 3953 addTestSource(''' |
4138 import "/testB.dart"; | 3954 import "/testB.dart"; |
4139 foo2() { } | 3955 foo2() { } |
4140 void bar2() { } | 3956 void bar2() { } |
4141 class Y {Y.c(); Y._d(); z() {}} | 3957 class Y {Y.c(); Y._d(); z() {}} |
4142 class C {bar(){var f; {var x;} var e = ^ var g}}'''); | 3958 class C {bar(){var f; {var x;} var e = ^ var g}}'''); |
4143 await computeSuggestions(); | 3959 await computeSuggestions(); |
4144 | 3960 |
4145 expect(replacementOffset, completionOffset); | 3961 expect(replacementOffset, completionOffset); |
4146 expect(replacementLength, 0); | 3962 expect(replacementLength, 0); |
4147 assertNotSuggested('X'); | 3963 assertNotSuggested('X'); |
4148 assertNotSuggested('foo1'); | 3964 assertNotSuggested('foo1'); |
4149 assertNotSuggested('bar1'); | 3965 assertNotSuggested('bar1'); |
4150 assertNotSuggested('foo2'); | 3966 assertNotSuggested('foo2'); |
4151 assertNotSuggested('bar2'); | 3967 assertNotSuggested('bar2'); |
4152 assertNotSuggested('_B'); | 3968 assertNotSuggested('_B'); |
4153 assertNotSuggested('Y'); | 3969 assertNotSuggested('Y'); |
4154 assertNotSuggested('C'); | 3970 assertNotSuggested('C'); |
4155 assertNotSuggested('f'); | 3971 assertNotSuggested('f'); |
4156 assertNotSuggested('x'); | 3972 assertNotSuggested('x'); |
4157 assertNotSuggested('e'); | 3973 assertNotSuggested('e'); |
4158 } | 3974 } |
4159 } | 3975 } |
OLD | NEW |