| 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 library test.services.completion.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, | 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, |
| 10 ElementKind; | 10 ElementKind; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return null; | 96 return null; |
| 97 } | 97 } |
| 98 | 98 |
| 99 CompletionSuggestion assertSuggest(String completion, | 99 CompletionSuggestion assertSuggest(String completion, |
| 100 {CompletionSuggestionKind csKind: CompletionSuggestionKind.INVOCATION, | 100 {CompletionSuggestionKind csKind: CompletionSuggestionKind.INVOCATION, |
| 101 int relevance: COMPLETION_RELEVANCE_DEFAULT, protocol.ElementKind elemKind
: | 101 int relevance: COMPLETION_RELEVANCE_DEFAULT, protocol.ElementKind elemKind
: |
| 102 null, bool isDeprecated: false, bool isPotential: false}) { | 102 null, bool isDeprecated: false, bool isPotential: false}) { |
| 103 CompletionSuggestion cs = | 103 CompletionSuggestion cs = |
| 104 getSuggest(completion: completion, csKind: csKind, elemKind: elemKind); | 104 getSuggest(completion: completion, csKind: csKind, elemKind: elemKind); |
| 105 if (cs == null) { | 105 if (cs == null) { |
| 106 failedCompletion('expected $completion $csKind', request.suggestions); | 106 failedCompletion( |
| 107 'expected $completion $csKind $elemKind', |
| 108 request.suggestions); |
| 107 } | 109 } |
| 108 expect(cs.kind, equals(csKind)); | 110 expect(cs.kind, equals(csKind)); |
| 109 if (isDeprecated) { | 111 if (isDeprecated) { |
| 110 expect(cs.relevance, equals(COMPLETION_RELEVANCE_LOW)); | 112 expect(cs.relevance, equals(COMPLETION_RELEVANCE_LOW)); |
| 111 } else { | 113 } else { |
| 112 expect(cs.relevance, equals(relevance)); | 114 expect(cs.relevance, equals(relevance)); |
| 113 } | 115 } |
| 114 expect(cs.selectionOffset, equals(completion.length)); | 116 expect(cs.selectionOffset, equals(completion.length)); |
| 115 expect(cs.selectionLength, equals(0)); | 117 expect(cs.selectionLength, equals(0)); |
| 116 expect(cs.isDeprecated, equals(isDeprecated)); | 118 expect(cs.isDeprecated, equals(isDeprecated)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 assertSuggest(name, csKind: kind, relevance: relevance); | 184 assertSuggest(name, csKind: kind, relevance: relevance); |
| 183 protocol.Element element = cs.element; | 185 protocol.Element element = cs.element; |
| 184 expect(element, isNotNull); | 186 expect(element, isNotNull); |
| 185 expect(element.kind, equals(protocol.ElementKind.CLASS_TYPE_ALIAS)); | 187 expect(element.kind, equals(protocol.ElementKind.CLASS_TYPE_ALIAS)); |
| 186 expect(element.name, equals(name)); | 188 expect(element.name, equals(name)); |
| 187 expect(element.parameters, isNull); | 189 expect(element.parameters, isNull); |
| 188 expect(element.returnType, isNull); | 190 expect(element.returnType, isNull); |
| 189 return cs; | 191 return cs; |
| 190 } | 192 } |
| 191 | 193 |
| 192 CompletionSuggestion assertSuggestField(String name, {int relevance: | 194 CompletionSuggestion assertSuggestField(String name, String type, |
| 193 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind: | 195 {int relevance: COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kin
d: |
| 194 CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) { | 196 CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) { |
| 195 CompletionSuggestion cs = assertSuggest( | 197 CompletionSuggestion cs = assertSuggest( |
| 196 name, | 198 name, |
| 197 csKind: kind, | 199 csKind: kind, |
| 198 relevance: relevance, | 200 relevance: relevance, |
| 199 elemKind: protocol.ElementKind.FIELD, | 201 elemKind: protocol.ElementKind.FIELD, |
| 200 isDeprecated: isDeprecated); | 202 isDeprecated: isDeprecated); |
| 201 expect(cs.returnType, isNull); | 203 // The returnType represents the type of a field |
| 204 expect(cs.returnType, type != null ? type : 'dynamic'); |
| 202 protocol.Element element = cs.element; | 205 protocol.Element element = cs.element; |
| 203 expect(element, isNotNull); | 206 expect(element, isNotNull); |
| 204 expect(element.kind, equals(protocol.ElementKind.FIELD)); | 207 expect(element.kind, equals(protocol.ElementKind.FIELD)); |
| 205 expect(element.name, equals(name)); | 208 expect(element.name, equals(name)); |
| 206 expect(element.parameters, isNull); | 209 expect(element.parameters, isNull); |
| 207 // TODO (danrubel) return type should be null and there should be | 210 // The returnType represents the type of a field |
| 208 // something that represents the type of the field | 211 expect(element.returnType, type != null ? type : 'dynamic'); |
| 209 if (element.returnType != null) { | |
| 210 expect(element.returnType, 'dynamic'); | |
| 211 } | |
| 212 return cs; | 212 return cs; |
| 213 } | 213 } |
| 214 | 214 |
| 215 CompletionSuggestion assertSuggestFunction(String name, String returnType, | 215 CompletionSuggestion assertSuggestFunction(String name, String returnType, |
| 216 bool isDeprecated, [int relevance = COMPLETION_RELEVANCE_DEFAULT, | 216 bool isDeprecated, [int relevance = COMPLETION_RELEVANCE_DEFAULT, |
| 217 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { | 217 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { |
| 218 CompletionSuggestion cs = assertSuggest( | 218 CompletionSuggestion cs = assertSuggest( |
| 219 name, | 219 name, |
| 220 csKind: kind, | 220 csKind: kind, |
| 221 relevance: relevance, | 221 relevance: relevance, |
| 222 isDeprecated: isDeprecated); | 222 isDeprecated: isDeprecated); |
| 223 expect(cs.returnType, equals(returnType)); | 223 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 224 protocol.Element element = cs.element; | 224 protocol.Element element = cs.element; |
| 225 expect(element, isNotNull); | 225 expect(element, isNotNull); |
| 226 expect(element.kind, equals(protocol.ElementKind.FUNCTION)); | 226 expect(element.kind, equals(protocol.ElementKind.FUNCTION)); |
| 227 expect(element.name, equals(name)); | 227 expect(element.name, equals(name)); |
| 228 expect(element.isDeprecated, equals(isDeprecated)); | 228 expect(element.isDeprecated, equals(isDeprecated)); |
| 229 String param = element.parameters; | 229 String param = element.parameters; |
| 230 expect(param, isNotNull); | 230 expect(param, isNotNull); |
| 231 expect(param[0], equals('(')); | 231 expect(param[0], equals('(')); |
| 232 expect(param[param.length - 1], equals(')')); | 232 expect(param[param.length - 1], equals(')')); |
| 233 expect( | 233 expect( |
| 234 element.returnType, | 234 element.returnType, |
| 235 equals(returnType != null ? returnType : 'dynamic')); | 235 equals(returnType != null ? returnType : 'dynamic')); |
| 236 return cs; | 236 return cs; |
| 237 } | 237 } |
| 238 | 238 |
| 239 CompletionSuggestion assertSuggestFunctionTypeAlias(String name, | 239 CompletionSuggestion assertSuggestFunctionTypeAlias(String name, |
| 240 String returnType, bool isDeprecated, [int relevance = | 240 String returnType, bool isDeprecated, [int relevance = |
| 241 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = | 241 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = |
| 242 CompletionSuggestionKind.INVOCATION]) { | 242 CompletionSuggestionKind.INVOCATION]) { |
| 243 CompletionSuggestion cs = assertSuggest( | 243 CompletionSuggestion cs = assertSuggest( |
| 244 name, | 244 name, |
| 245 csKind: kind, | 245 csKind: kind, |
| 246 relevance: relevance, | 246 relevance: relevance, |
| 247 isDeprecated: isDeprecated); | 247 isDeprecated: isDeprecated); |
| 248 expect(cs.returnType, equals(returnType)); | 248 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 249 protocol.Element element = cs.element; | 249 protocol.Element element = cs.element; |
| 250 expect(element, isNotNull); | 250 expect(element, isNotNull); |
| 251 expect(element.kind, equals(protocol.ElementKind.FUNCTION_TYPE_ALIAS)); | 251 expect(element.kind, equals(protocol.ElementKind.FUNCTION_TYPE_ALIAS)); |
| 252 expect(element.name, equals(name)); | 252 expect(element.name, equals(name)); |
| 253 expect(element.isDeprecated, equals(isDeprecated)); | 253 expect(element.isDeprecated, equals(isDeprecated)); |
| 254 // TODO (danrubel) Determine why params are null | 254 // TODO (danrubel) Determine why params are null |
| 255 // String param = element.parameters; | 255 // String param = element.parameters; |
| 256 // expect(param, isNotNull); | 256 // expect(param, isNotNull); |
| 257 // expect(param[0], equals('(')); | 257 // expect(param[0], equals('(')); |
| 258 // expect(param[param.length - 1], equals(')')); | 258 // expect(param[param.length - 1], equals(')')); |
| 259 // TODO (danrubel) Determine why return type is null | 259 // TODO (danrubel) Determine why return type is null |
| 260 // expect( | 260 // expect( |
| 261 // element.returnType, | 261 // element.returnType, |
| 262 // equals(returnType != null ? returnType : 'dynamic')); | 262 // equals(returnType != null ? returnType : 'dynamic')); |
| 263 return cs; | 263 return cs; |
| 264 } | 264 } |
| 265 | 265 |
| 266 CompletionSuggestion assertSuggestGetter(String name, String returnType, | 266 CompletionSuggestion assertSuggestGetter(String name, String returnType, |
| 267 {int relevance: COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kin
d: | 267 {int relevance: COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kin
d: |
| 268 CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) { | 268 CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) { |
| 269 CompletionSuggestion cs = assertSuggest( | 269 CompletionSuggestion cs = assertSuggest( |
| 270 name, | 270 name, |
| 271 csKind: kind, | 271 csKind: kind, |
| 272 relevance: relevance, | 272 relevance: relevance, |
| 273 elemKind: protocol.ElementKind.GETTER, | 273 elemKind: protocol.ElementKind.GETTER, |
| 274 isDeprecated: isDeprecated); | 274 isDeprecated: isDeprecated); |
| 275 expect(cs.returnType, equals(returnType)); | 275 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 276 protocol.Element element = cs.element; | 276 protocol.Element element = cs.element; |
| 277 expect(element, isNotNull); | 277 expect(element, isNotNull); |
| 278 expect(element.kind, equals(protocol.ElementKind.GETTER)); | 278 expect(element.kind, equals(protocol.ElementKind.GETTER)); |
| 279 expect(element.name, equals(name)); | 279 expect(element.name, equals(name)); |
| 280 //TODO (danrubel) getter should have parameters | 280 //TODO (danrubel) getter should have parameters |
| 281 // but not used in code completion | 281 // but not used in code completion |
| 282 //expect(element.parameters, '()'); | 282 //expect(element.parameters, '()'); |
| 283 expect( | 283 expect( |
| 284 element.returnType, | 284 element.returnType, |
| 285 equals(returnType != null ? returnType : 'dynamic')); | 285 equals(returnType != null ? returnType : 'dynamic')); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 | 322 |
| 323 CompletionSuggestion assertSuggestLocalVariable(String name, | 323 CompletionSuggestion assertSuggestLocalVariable(String name, |
| 324 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, | 324 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, |
| 325 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { | 325 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { |
| 326 // Local variables should only be suggested by LocalComputer | 326 // Local variables should only be suggested by LocalComputer |
| 327 if (computer is LocalComputer) { | 327 if (computer is LocalComputer) { |
| 328 CompletionSuggestion cs = | 328 CompletionSuggestion cs = |
| 329 assertSuggest(name, csKind: kind, relevance: relevance); | 329 assertSuggest(name, csKind: kind, relevance: relevance); |
| 330 expect(cs.returnType, equals(returnType)); | 330 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 331 protocol.Element element = cs.element; | 331 protocol.Element element = cs.element; |
| 332 expect(element, isNotNull); | 332 expect(element, isNotNull); |
| 333 expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE)); | 333 expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE)); |
| 334 expect(element.name, equals(name)); | 334 expect(element.name, equals(name)); |
| 335 expect(element.parameters, isNull); | 335 expect(element.parameters, isNull); |
| 336 expect( | 336 expect(element.returnType, returnType != null ? returnType : 'dynamic'); |
| 337 element.returnType, | |
| 338 equals(returnType != null ? returnType : 'dynamic')); | |
| 339 return cs; | 337 return cs; |
| 340 } else { | 338 } else { |
| 341 return assertNotSuggested(name); | 339 return assertNotSuggested(name); |
| 342 } | 340 } |
| 343 } | 341 } |
| 344 | 342 |
| 345 CompletionSuggestion assertSuggestMethod(String name, String declaringType, | 343 CompletionSuggestion assertSuggestMethod(String name, String declaringType, |
| 346 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, | 344 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, |
| 347 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { | 345 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { |
| 348 CompletionSuggestion cs = | 346 CompletionSuggestion cs = |
| 349 assertSuggest(name, csKind: kind, relevance: relevance); | 347 assertSuggest(name, csKind: kind, relevance: relevance); |
| 350 expect(cs.declaringType, equals(declaringType)); | 348 expect(cs.declaringType, equals(declaringType)); |
| 351 expect(cs.returnType, equals(returnType)); | 349 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 352 protocol.Element element = cs.element; | 350 protocol.Element element = cs.element; |
| 353 expect(element, isNotNull); | 351 expect(element, isNotNull); |
| 354 expect(element.kind, equals(protocol.ElementKind.METHOD)); | 352 expect(element.kind, equals(protocol.ElementKind.METHOD)); |
| 355 expect(element.name, equals(name)); | 353 expect(element.name, equals(name)); |
| 356 String param = element.parameters; | 354 String param = element.parameters; |
| 357 expect(param, isNotNull); | 355 expect(param, isNotNull); |
| 358 expect(param[0], equals('(')); | 356 expect(param[0], equals('(')); |
| 359 expect(param[param.length - 1], equals(')')); | 357 expect(param[param.length - 1], equals(')')); |
| 360 expect( | 358 expect(element.returnType, returnType != null ? returnType : 'dynamic'); |
| 361 element.returnType, | |
| 362 equals(returnType != null ? returnType : 'dynamic')); | |
| 363 return cs; | 359 return cs; |
| 364 } | 360 } |
| 365 | 361 |
| 366 CompletionSuggestion assertSuggestNamedConstructor(String name, | 362 CompletionSuggestion assertSuggestNamedConstructor(String name, |
| 367 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, | 363 String returnType, [int relevance = COMPLETION_RELEVANCE_DEFAULT, |
| 368 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { | 364 CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) { |
| 369 if (computer is InvocationComputer) { | 365 if (computer is InvocationComputer) { |
| 370 CompletionSuggestion cs = | 366 CompletionSuggestion cs = |
| 371 assertSuggest(name, csKind: kind, relevance: relevance); | 367 assertSuggest(name, csKind: kind, relevance: relevance); |
| 372 protocol.Element element = cs.element; | 368 protocol.Element element = cs.element; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 384 } | 380 } |
| 385 } | 381 } |
| 386 | 382 |
| 387 CompletionSuggestion assertSuggestParameter(String name, String returnType, | 383 CompletionSuggestion assertSuggestParameter(String name, String returnType, |
| 388 [int relevance = COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind ki
nd = | 384 [int relevance = COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind ki
nd = |
| 389 CompletionSuggestionKind.INVOCATION]) { | 385 CompletionSuggestionKind.INVOCATION]) { |
| 390 // Parameters should only be suggested by LocalComputer | 386 // Parameters should only be suggested by LocalComputer |
| 391 if (computer is LocalComputer) { | 387 if (computer is LocalComputer) { |
| 392 CompletionSuggestion cs = | 388 CompletionSuggestion cs = |
| 393 assertSuggest(name, csKind: kind, relevance: relevance); | 389 assertSuggest(name, csKind: kind, relevance: relevance); |
| 394 expect(cs.returnType, equals(returnType)); | 390 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 395 protocol.Element element = cs.element; | 391 protocol.Element element = cs.element; |
| 396 expect(element, isNotNull); | 392 expect(element, isNotNull); |
| 397 expect(element.kind, equals(protocol.ElementKind.PARAMETER)); | 393 expect(element.kind, equals(protocol.ElementKind.PARAMETER)); |
| 398 expect(element.name, equals(name)); | 394 expect(element.name, equals(name)); |
| 399 expect(element.parameters, isNull); | 395 expect(element.parameters, isNull); |
| 400 expect( | 396 expect( |
| 401 element.returnType, | 397 element.returnType, |
| 402 equals(returnType != null ? returnType : 'dynamic')); | 398 equals(returnType != null ? returnType : 'dynamic')); |
| 403 return cs; | 399 return cs; |
| 404 } else { | 400 } else { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 425 expect(element.returnType, 'dynamic'); | 421 expect(element.returnType, 'dynamic'); |
| 426 } | 422 } |
| 427 return cs; | 423 return cs; |
| 428 } | 424 } |
| 429 | 425 |
| 430 CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType, | 426 CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType, |
| 431 [int relevance = COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind ki
nd = | 427 [int relevance = COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind ki
nd = |
| 432 CompletionSuggestionKind.INVOCATION]) { | 428 CompletionSuggestionKind.INVOCATION]) { |
| 433 CompletionSuggestion cs = | 429 CompletionSuggestion cs = |
| 434 assertSuggest(name, csKind: kind, relevance: relevance); | 430 assertSuggest(name, csKind: kind, relevance: relevance); |
| 435 expect(cs.returnType, equals(returnType)); | 431 expect(cs.returnType, returnType != null ? returnType : 'dynamic'); |
| 436 protocol.Element element = cs.element; | 432 protocol.Element element = cs.element; |
| 437 expect(element, isNotNull); | 433 expect(element, isNotNull); |
| 438 expect(element.kind, equals(protocol.ElementKind.TOP_LEVEL_VARIABLE)); | 434 expect(element.kind, equals(protocol.ElementKind.TOP_LEVEL_VARIABLE)); |
| 439 expect(element.name, equals(name)); | 435 expect(element.name, equals(name)); |
| 440 expect(element.parameters, isNull); | 436 expect(element.parameters, isNull); |
| 441 //TODO (danrubel) return type level variable 'type' but not as 'returnType' | 437 expect(element.returnType, returnType != null ? returnType : 'dynamic'); |
| 442 // expect( | |
| 443 // element.returnType, | |
| 444 // equals(returnType != null ? returnType : 'dynamic')); | |
| 445 return cs; | 438 return cs; |
| 446 } | 439 } |
| 447 | 440 |
| 448 void assertSuggestTopLevelVarGetterSetter(String name, String returnType, | 441 void assertSuggestTopLevelVarGetterSetter(String name, String returnType, |
| 449 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { | 442 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { |
| 450 if (computer is ImportedComputer) { | 443 if (computer is ImportedComputer) { |
| 451 assertSuggestGetter(name, returnType); | 444 assertSuggestGetter(name, returnType); |
| 452 assertSuggestSetter(name); | 445 assertSuggestSetter(name); |
| 453 } else { | 446 } else { |
| 454 assertNotSuggested(name); | 447 assertNotSuggested(name); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 CompletionSuggestion assertSuggestImportedClass(String name, [int relevance = | 609 CompletionSuggestion assertSuggestImportedClass(String name, [int relevance = |
| 617 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = | 610 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = |
| 618 CompletionSuggestionKind.INVOCATION]) { | 611 CompletionSuggestionKind.INVOCATION]) { |
| 619 if (computer is ImportedComputer) { | 612 if (computer is ImportedComputer) { |
| 620 return assertSuggestClass(name, relevance, kind); | 613 return assertSuggestClass(name, relevance, kind); |
| 621 } else { | 614 } else { |
| 622 return assertNotSuggested(name); | 615 return assertNotSuggested(name); |
| 623 } | 616 } |
| 624 } | 617 } |
| 625 | 618 |
| 626 CompletionSuggestion assertSuggestImportedField(String name, [int relevance = | 619 CompletionSuggestion assertSuggestImportedField(String name, String type, |
| 627 COMPLETION_RELEVANCE_DEFAULT]) { | 620 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { |
| 628 if (computer is ImportedComputer) { | 621 return assertNotSuggested(name); |
| 629 return assertSuggestField(name, relevance: relevance); | |
| 630 } else { | |
| 631 return assertNotSuggested(name); | |
| 632 } | |
| 633 } | 622 } |
| 634 | 623 |
| 635 CompletionSuggestion assertSuggestImportedFunction(String name, | 624 CompletionSuggestion assertSuggestImportedFunction(String name, |
| 636 String returnType, [bool isDeprecated = false, int relevance = | 625 String returnType, [bool isDeprecated = false, int relevance = |
| 637 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = | 626 COMPLETION_RELEVANCE_DEFAULT, CompletionSuggestionKind kind = |
| 638 CompletionSuggestionKind.INVOCATION]) { | 627 CompletionSuggestionKind.INVOCATION]) { |
| 639 if (computer is ImportedComputer) { | 628 if (computer is ImportedComputer) { |
| 640 return assertSuggestFunction( | 629 return assertSuggestFunction( |
| 641 name, | 630 name, |
| 642 returnType, | 631 returnType, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 | 693 |
| 705 CompletionSuggestion assertSuggestInvocationClass(String name, [int relevance | 694 CompletionSuggestion assertSuggestInvocationClass(String name, [int relevance |
| 706 = COMPLETION_RELEVANCE_DEFAULT]) { | 695 = COMPLETION_RELEVANCE_DEFAULT]) { |
| 707 if (computer is InvocationComputer) { | 696 if (computer is InvocationComputer) { |
| 708 return assertSuggestClass(name, relevance); | 697 return assertSuggestClass(name, relevance); |
| 709 } else { | 698 } else { |
| 710 return assertNotSuggested(name); | 699 return assertNotSuggested(name); |
| 711 } | 700 } |
| 712 } | 701 } |
| 713 | 702 |
| 703 CompletionSuggestion assertSuggestInvocationField(String name, String type, |
| 704 {int relevance: COMPLETION_RELEVANCE_DEFAULT, bool isDeprecated: false}) { |
| 705 return assertNotSuggested(name); |
| 706 } |
| 707 |
| 714 CompletionSuggestion assertSuggestInvocationGetter(String name, | 708 CompletionSuggestion assertSuggestInvocationGetter(String name, |
| 715 String returnType, {int relevance: COMPLETION_RELEVANCE_DEFAULT, | 709 String returnType, {int relevance: COMPLETION_RELEVANCE_DEFAULT, |
| 716 bool isDeprecated: false}) { | 710 bool isDeprecated: false}) { |
| 717 if (computer is InvocationComputer) { | 711 if (computer is InvocationComputer) { |
| 718 return assertSuggestGetter( | 712 return assertSuggestGetter( |
| 719 name, | 713 name, |
| 720 returnType, | 714 returnType, |
| 721 relevance: relevance, | 715 relevance: relevance, |
| 722 isDeprecated: isDeprecated); | 716 isDeprecated: isDeprecated); |
| 723 } else { | 717 } else { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 758 |
| 765 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name, | 759 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name, |
| 766 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { | 760 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { |
| 767 if (computer is LocalComputer) { | 761 if (computer is LocalComputer) { |
| 768 return assertSuggestClassTypeAlias(name, relevance); | 762 return assertSuggestClassTypeAlias(name, relevance); |
| 769 } else { | 763 } else { |
| 770 return assertNotSuggested(name); | 764 return assertNotSuggested(name); |
| 771 } | 765 } |
| 772 } | 766 } |
| 773 | 767 |
| 774 CompletionSuggestion assertSuggestLocalField(String name, [int relevance = | 768 CompletionSuggestion assertSuggestLocalField(String name, String type, |
| 775 COMPLETION_RELEVANCE_DEFAULT]) { | 769 [int relevance = COMPLETION_RELEVANCE_DEFAULT]) { |
| 776 if (computer is LocalComputer) { | 770 return assertNotSuggested(name); |
| 777 return assertSuggestField(name, relevance: relevance); | |
| 778 } else { | |
| 779 return assertNotSuggested(name); | |
| 780 } | |
| 781 } | 771 } |
| 782 | 772 |
| 783 CompletionSuggestion assertSuggestLocalFunction(String name, | 773 CompletionSuggestion assertSuggestLocalFunction(String name, |
| 784 String returnType, [bool isDeprecated = false, int relevance = | 774 String returnType, [bool isDeprecated = false, int relevance = |
| 785 COMPLETION_RELEVANCE_DEFAULT]) { | 775 COMPLETION_RELEVANCE_DEFAULT]) { |
| 786 if (computer is LocalComputer) { | 776 if (computer is LocalComputer) { |
| 787 return assertSuggestFunction(name, returnType, isDeprecated, relevance); | 777 return assertSuggestFunction(name, returnType, isDeprecated, relevance); |
| 788 } else { | 778 } else { |
| 789 return assertNotSuggested(name); | 779 return assertNotSuggested(name); |
| 790 } | 780 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 lib B; | 1298 lib B; |
| 1309 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } } | 1299 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } } |
| 1310 class E extends F { var e1; e2() { } } | 1300 class E extends F { var e1; e2() { } } |
| 1311 class I { int i1; i2() { } get e1; } | 1301 class I { int i1; i2() { } get e1; } |
| 1312 class M { var m1; int m2() { } }'''); | 1302 class M { var m1; int m2() { } }'''); |
| 1313 addTestSource(''' | 1303 addTestSource(''' |
| 1314 import "/testB.dart"; | 1304 import "/testB.dart"; |
| 1315 class A extends E implements I with M {a() {^}}'''); | 1305 class A extends E implements I with M {a() {^}}'''); |
| 1316 computeFast(); | 1306 computeFast(); |
| 1317 return computeFull((bool result) { | 1307 return computeFull((bool result) { |
| 1318 assertSuggestImportedField('e1'); | 1308 assertSuggestImportedField('e1', null); |
| 1319 assertSuggestImportedField('f1'); | 1309 assertSuggestImportedField('f1', null); |
| 1320 assertSuggestImportedField('i1'); | 1310 assertSuggestImportedField('i1', 'int'); |
| 1321 assertSuggestImportedField('m1'); | 1311 assertSuggestImportedField('m1', null); |
| 1322 assertSuggestImportedGetter('f3', null); | 1312 assertSuggestImportedGetter('f3', null); |
| 1323 assertSuggestImportedSetter('f4'); | 1313 assertSuggestImportedSetter('f4'); |
| 1324 //TODO (danrubel) include declared type in suggestion | 1314 //TODO (danrubel) include declared type in suggestion |
| 1325 assertSuggestImportedMethod('e2', null, null); | 1315 assertSuggestImportedMethod('e2', null, null); |
| 1326 assertSuggestImportedMethod('f2', null, null); | 1316 assertSuggestImportedMethod('f2', null, null); |
| 1327 assertSuggestImportedMethod('i2', null, null); | 1317 assertSuggestImportedMethod('i2', null, null); |
| 1328 //assertSuggestImportedMethod('m2', null, null); | 1318 //assertSuggestImportedMethod('m2', null, null); |
| 1329 assertNotSuggested('=='); | 1319 assertNotSuggested('=='); |
| 1330 }); | 1320 }); |
| 1331 } | 1321 } |
| 1332 | 1322 |
| 1333 test_Block_inherited_local() { | 1323 test_Block_inherited_local() { |
| 1334 // Block BlockFunctionBody MethodDeclaration ClassDeclaration | 1324 // Block BlockFunctionBody MethodDeclaration ClassDeclaration |
| 1335 addTestSource(''' | 1325 addTestSource(''' |
| 1336 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } } | 1326 class F { var f1; f2() { } get f3 => 0; set f4(fx) { } } |
| 1337 class E extends F { var e1; e2() { } } | 1327 class E extends F { var e1; e2() { } } |
| 1338 class I { int i1; i2() { } } | 1328 class I { int i1; i2() { } } |
| 1339 class M { var m1; int m2() { } } | 1329 class M { var m1; int m2() { } } |
| 1340 class A extends E implements I with M {a() {^}}'''); | 1330 class A extends E implements I with M {a() {^}}'''); |
| 1341 computeFast(); | 1331 computeFast(); |
| 1342 return computeFull((bool result) { | 1332 return computeFull((bool result) { |
| 1343 assertSuggestLocalField('e1'); | 1333 assertSuggestLocalField('e1', null); |
| 1344 assertSuggestLocalField('f1'); | 1334 assertSuggestLocalField('f1', null); |
| 1345 assertSuggestLocalField('i1'); | 1335 assertSuggestLocalField('i1', 'int'); |
| 1346 assertSuggestLocalField('m1'); | 1336 assertSuggestLocalField('m1', null); |
| 1347 assertSuggestLocalGetter('f3', null); | 1337 assertSuggestLocalGetter('f3', null); |
| 1348 assertSuggestLocalSetter('f4'); | 1338 assertSuggestLocalSetter('f4'); |
| 1349 assertSuggestLocalMethod('e2', 'E', null); | 1339 assertSuggestLocalMethod('e2', 'E', null); |
| 1350 assertSuggestLocalMethod('f2', 'F', null); | 1340 assertSuggestLocalMethod('f2', 'F', null); |
| 1351 assertSuggestLocalMethod('i2', 'I', null); | 1341 assertSuggestLocalMethod('i2', 'I', null); |
| 1352 assertSuggestLocalMethod('m2', 'M', 'int'); | 1342 assertSuggestLocalMethod('m2', 'M', 'int'); |
| 1353 }); | 1343 }); |
| 1354 } | 1344 } |
| 1355 | 1345 |
| 1356 test_CascadeExpression_selector1() { | 1346 test_CascadeExpression_selector1() { |
| 1357 // PropertyAccess CascadeExpression ExpressionStatement Block | 1347 // PropertyAccess CascadeExpression ExpressionStatement Block |
| 1358 addSource('/testB.dart', ''' | 1348 addSource('/testB.dart', ''' |
| 1359 class B { }'''); | 1349 class B { }'''); |
| 1360 addTestSource(''' | 1350 addTestSource(''' |
| 1361 import "/testB.dart"; | 1351 import "/testB.dart"; |
| 1362 class A {var b; X _c;} | 1352 class A {var b; X _c;} |
| 1363 class X{} | 1353 class X{} |
| 1364 // looks like a cascade to the parser | 1354 // looks like a cascade to the parser |
| 1365 // but the user is trying to get completions for a non-cascade | 1355 // but the user is trying to get completions for a non-cascade |
| 1366 main() {A a; a.^.z}'''); | 1356 main() {A a; a.^.z}'''); |
| 1367 computeFast(); | 1357 computeFast(); |
| 1368 return computeFull((bool result) { | 1358 return computeFull((bool result) { |
| 1369 assertSuggestInvocationGetter('b', null); | 1359 assertSuggestInvocationField('b', null); |
| 1370 assertSuggestInvocationGetter('_c', 'X'); | 1360 assertSuggestInvocationField('_c', 'X'); |
| 1371 assertNotSuggested('Object'); | 1361 assertNotSuggested('Object'); |
| 1372 assertNotSuggested('A'); | 1362 assertNotSuggested('A'); |
| 1373 assertNotSuggested('B'); | 1363 assertNotSuggested('B'); |
| 1374 assertNotSuggested('X'); | 1364 assertNotSuggested('X'); |
| 1375 assertNotSuggested('z'); | 1365 assertNotSuggested('z'); |
| 1376 assertNotSuggested('=='); | 1366 assertNotSuggested('=='); |
| 1377 }); | 1367 }); |
| 1378 } | 1368 } |
| 1379 | 1369 |
| 1380 test_CascadeExpression_selector2() { | 1370 test_CascadeExpression_selector2() { |
| 1381 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement | 1371 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement |
| 1382 addSource('/testB.dart', ''' | 1372 addSource('/testB.dart', ''' |
| 1383 class B { }'''); | 1373 class B { }'''); |
| 1384 addTestSource(''' | 1374 addTestSource(''' |
| 1385 import "/testB.dart"; | 1375 import "/testB.dart"; |
| 1386 class A {var b; X _c;} | 1376 class A {var b; X _c;} |
| 1387 class X{} | 1377 class X{} |
| 1388 main() {A a; a..^z}'''); | 1378 main() {A a; a..^z}'''); |
| 1389 computeFast(); | 1379 computeFast(); |
| 1390 return computeFull((bool result) { | 1380 return computeFull((bool result) { |
| 1391 assertSuggestInvocationGetter('b', null); | 1381 assertSuggestInvocationField('b', null); |
| 1392 assertSuggestInvocationGetter('_c', 'X'); | 1382 assertSuggestInvocationField('_c', 'X'); |
| 1393 assertNotSuggested('Object'); | 1383 assertNotSuggested('Object'); |
| 1394 assertNotSuggested('A'); | 1384 assertNotSuggested('A'); |
| 1395 assertNotSuggested('B'); | 1385 assertNotSuggested('B'); |
| 1396 assertNotSuggested('X'); | 1386 assertNotSuggested('X'); |
| 1397 assertNotSuggested('z'); | 1387 assertNotSuggested('z'); |
| 1398 assertNotSuggested('=='); | 1388 assertNotSuggested('=='); |
| 1399 }); | 1389 }); |
| 1400 } | 1390 } |
| 1401 | 1391 |
| 1402 test_CascadeExpression_selector2_withTrailingReturn() { | 1392 test_CascadeExpression_selector2_withTrailingReturn() { |
| 1403 // PropertyAccess CascadeExpression ExpressionStatement Block | 1393 // PropertyAccess CascadeExpression ExpressionStatement Block |
| 1404 addSource('/testB.dart', ''' | 1394 addSource('/testB.dart', ''' |
| 1405 class B { }'''); | 1395 class B { }'''); |
| 1406 addTestSource(''' | 1396 addTestSource(''' |
| 1407 import "/testB.dart"; | 1397 import "/testB.dart"; |
| 1408 class A {var b; X _c;} | 1398 class A {var b; X _c;} |
| 1409 class X{} | 1399 class X{} |
| 1410 main() {A a; a..^ return}'''); | 1400 main() {A a; a..^ return}'''); |
| 1411 computeFast(); | 1401 computeFast(); |
| 1412 return computeFull((bool result) { | 1402 return computeFull((bool result) { |
| 1413 assertSuggestInvocationGetter('b', null); | 1403 assertSuggestInvocationField('b', null); |
| 1414 assertSuggestInvocationGetter('_c', 'X'); | 1404 assertSuggestInvocationField('_c', 'X'); |
| 1415 assertNotSuggested('Object'); | 1405 assertNotSuggested('Object'); |
| 1416 assertNotSuggested('A'); | 1406 assertNotSuggested('A'); |
| 1417 assertNotSuggested('B'); | 1407 assertNotSuggested('B'); |
| 1418 assertNotSuggested('X'); | 1408 assertNotSuggested('X'); |
| 1419 assertNotSuggested('z'); | 1409 assertNotSuggested('z'); |
| 1420 assertNotSuggested('=='); | 1410 assertNotSuggested('=='); |
| 1421 }); | 1411 }); |
| 1422 } | 1412 } |
| 1423 | 1413 |
| 1424 test_CascadeExpression_target() { | 1414 test_CascadeExpression_target() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 assertNoSuggestions(); | 1538 assertNoSuggestions(); |
| 1549 }); | 1539 }); |
| 1550 } | 1540 } |
| 1551 | 1541 |
| 1552 test_ConditionalExpression_empty() { | 1542 test_ConditionalExpression_empty() { |
| 1553 // SimpleIdentifier PrefixIdentifier IfStatement | 1543 // SimpleIdentifier PrefixIdentifier IfStatement |
| 1554 addTestSource(''' | 1544 addTestSource(''' |
| 1555 class A {var b; X _c; foo() {A a; if (^) something}}'''); | 1545 class A {var b; X _c; foo() {A a; if (^) something}}'''); |
| 1556 computeFast(); | 1546 computeFast(); |
| 1557 return computeFull((bool result) { | 1547 return computeFull((bool result) { |
| 1558 assertSuggestLocalField('b'); | 1548 assertSuggestLocalField('b', null); |
| 1559 assertSuggestLocalField('_c'); | 1549 assertSuggestLocalField('_c', 'X'); |
| 1560 assertSuggestImportedClass('Object'); | 1550 assertSuggestImportedClass('Object'); |
| 1561 assertSuggestLocalClass('A'); | 1551 assertSuggestLocalClass('A'); |
| 1562 assertNotSuggested('=='); | 1552 assertNotSuggested('=='); |
| 1563 }); | 1553 }); |
| 1564 } | 1554 } |
| 1565 | 1555 |
| 1566 test_ConditionalExpression_invocation() { | 1556 test_ConditionalExpression_invocation() { |
| 1567 // SimpleIdentifier PrefixIdentifier IfStatement | 1557 // SimpleIdentifier PrefixIdentifier IfStatement |
| 1568 addTestSource(''' | 1558 addTestSource(''' |
| 1569 main() {var a; if (a.^) something}'''); | 1559 main() {var a; if (a.^) something}'''); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 // Block BlockFunctionBody MethodDeclaration | 2041 // Block BlockFunctionBody MethodDeclaration |
| 2052 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}'); | 2042 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}'); |
| 2053 computeFast(); | 2043 computeFast(); |
| 2054 return computeFull((bool result) { | 2044 return computeFull((bool result) { |
| 2055 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z'); | 2045 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z'); |
| 2056 if (methodA != null) { | 2046 if (methodA != null) { |
| 2057 expect(methodA.element.isDeprecated, isFalse); | 2047 expect(methodA.element.isDeprecated, isFalse); |
| 2058 expect(methodA.element.isPrivate, isTrue); | 2048 expect(methodA.element.isPrivate, isTrue); |
| 2059 } | 2049 } |
| 2060 CompletionSuggestion getterF = | 2050 CompletionSuggestion getterF = |
| 2061 assertSuggestLocalField('f', COMPLETION_RELEVANCE_LOW); | 2051 assertSuggestLocalField('f', 'X', COMPLETION_RELEVANCE_LOW); |
| 2062 if (getterF != null) { | 2052 if (getterF != null) { |
| 2063 expect(getterF.element.isDeprecated, isTrue); | 2053 expect(getterF.element.isDeprecated, isTrue); |
| 2064 expect(getterF.element.isPrivate, isFalse); | 2054 expect(getterF.element.isPrivate, isFalse); |
| 2065 expect(getterF.element.parameters, isNull); | 2055 expect(getterF.element.parameters, isNull); |
| 2066 } | 2056 } |
| 2067 CompletionSuggestion getterG = assertSuggestLocalField('_g'); | 2057 CompletionSuggestion getterG = assertSuggestLocalField('_g', null); |
| 2068 if (getterG != null) { | 2058 if (getterG != null) { |
| 2069 expect(getterG.element.isDeprecated, isFalse); | 2059 expect(getterG.element.isDeprecated, isFalse); |
| 2070 expect(getterG.element.isPrivate, isTrue); | 2060 expect(getterG.element.isPrivate, isTrue); |
| 2071 expect(getterF.element.parameters, isNull); | 2061 expect(getterF.element.parameters, isNull); |
| 2072 } | 2062 } |
| 2073 assertSuggestImportedClass('bool'); | 2063 assertSuggestImportedClass('bool'); |
| 2074 }); | 2064 }); |
| 2075 } | 2065 } |
| 2076 | 2066 |
| 2077 test_MethodDeclaration_parameters_named() { | 2067 test_MethodDeclaration_parameters_named() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 m(X x) {} I _n(X x) {}} | 2210 m(X x) {} I _n(X x) {}} |
| 2221 class X{}'''); | 2211 class X{}'''); |
| 2222 addTestSource(''' | 2212 addTestSource(''' |
| 2223 import "/testB.dart"; | 2213 import "/testB.dart"; |
| 2224 class A extends B { | 2214 class A extends B { |
| 2225 static const String scA = 'foo'; | 2215 static const String scA = 'foo'; |
| 2226 w() { }} | 2216 w() { }} |
| 2227 main() {A.^}'''); | 2217 main() {A.^}'''); |
| 2228 computeFast(); | 2218 computeFast(); |
| 2229 return computeFull((bool result) { | 2219 return computeFull((bool result) { |
| 2230 assertSuggestInvocationGetter('scA', 'String'); | 2220 assertSuggestInvocationField('scA', 'String'); |
| 2231 assertSuggestInvocationGetter('scB', 'int'); | 2221 assertSuggestInvocationField('scB', 'int'); |
| 2232 assertSuggestInvocationGetter('scI', null); | 2222 assertSuggestInvocationField('scI', null); |
| 2233 assertNotSuggested('b'); | 2223 assertNotSuggested('b'); |
| 2234 assertNotSuggested('_c'); | 2224 assertNotSuggested('_c'); |
| 2235 assertNotSuggested('d'); | 2225 assertNotSuggested('d'); |
| 2236 assertNotSuggested('_e'); | 2226 assertNotSuggested('_e'); |
| 2237 assertNotSuggested('f'); | 2227 assertNotSuggested('f'); |
| 2238 assertNotSuggested('_g'); | 2228 assertNotSuggested('_g'); |
| 2239 assertNotSuggested('s1'); | 2229 assertNotSuggested('s1'); |
| 2240 assertNotSuggested('_s2'); | 2230 assertNotSuggested('_s2'); |
| 2241 assertNotSuggested('m'); | 2231 assertNotSuggested('m'); |
| 2242 assertNotSuggested('_n'); | 2232 assertNotSuggested('_n'); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2259 @deprecated var b; X _c; | 2249 @deprecated var b; X _c; |
| 2260 X get d => new A();get _e => new A(); | 2250 X get d => new A();get _e => new A(); |
| 2261 set s1(I x) {} set _s2(I x) {} | 2251 set s1(I x) {} set _s2(I x) {} |
| 2262 m(X x) {} I _n(X x) {}} | 2252 m(X x) {} I _n(X x) {}} |
| 2263 class X{}'''); | 2253 class X{}'''); |
| 2264 addTestSource(''' | 2254 addTestSource(''' |
| 2265 import "/testB.dart"; | 2255 import "/testB.dart"; |
| 2266 main() {A a; a.^}'''); | 2256 main() {A a; a.^}'''); |
| 2267 computeFast(); | 2257 computeFast(); |
| 2268 return computeFull((bool result) { | 2258 return computeFull((bool result) { |
| 2269 assertSuggestInvocationGetter('sc', 'int'); | 2259 assertSuggestInvocationField('sc', 'int'); |
| 2270 assertSuggestInvocationGetter('b', null, isDeprecated: true); | 2260 assertSuggestInvocationField('b', null, isDeprecated: true); |
| 2271 assertNotSuggested('_c'); | 2261 assertNotSuggested('_c'); |
| 2272 assertSuggestInvocationGetter('d', 'X'); | 2262 assertSuggestInvocationGetter('d', 'X'); |
| 2273 assertNotSuggested('_e'); | 2263 assertNotSuggested('_e'); |
| 2274 assertSuggestInvocationGetter('f', 'X'); | 2264 assertSuggestInvocationGetter('f', 'X'); |
| 2275 assertNotSuggested('_g'); | 2265 assertNotSuggested('_g'); |
| 2276 assertSuggestInvocationSetter('s1'); | 2266 assertSuggestInvocationSetter('s1'); |
| 2277 assertNotSuggested('_s2'); | 2267 assertNotSuggested('_s2'); |
| 2278 assertSuggestInvocationMethod('m', 'A', null); | 2268 assertSuggestInvocationMethod('m', 'A', null); |
| 2279 assertNotSuggested('_n'); | 2269 assertNotSuggested('_n'); |
| 2280 assertNotSuggested('a'); | 2270 assertNotSuggested('a'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2292 class I {X get f => new A();get _g => new A();} | 2282 class I {X get f => new A();get _g => new A();} |
| 2293 class A implements I { | 2283 class A implements I { |
| 2294 static const int sc = 12; | 2284 static const int sc = 12; |
| 2295 var b; X _c; | 2285 var b; X _c; |
| 2296 X get d => new A();get _e => new A(); | 2286 X get d => new A();get _e => new A(); |
| 2297 set s1(I x) {} set _s2(I x) {} | 2287 set s1(I x) {} set _s2(I x) {} |
| 2298 m(X x) {} I _n(X x) {}} | 2288 m(X x) {} I _n(X x) {}} |
| 2299 class X{}'''); | 2289 class X{}'''); |
| 2300 computeFast(); | 2290 computeFast(); |
| 2301 return computeFull((bool result) { | 2291 return computeFull((bool result) { |
| 2302 assertSuggestInvocationGetter('sc', 'int'); | 2292 assertSuggestInvocationField('sc', 'int'); |
| 2303 assertSuggestInvocationGetter('b', null); | 2293 assertSuggestInvocationField('b', null); |
| 2304 assertSuggestInvocationGetter('_c', 'X'); | 2294 assertSuggestInvocationField('_c', 'X'); |
| 2305 assertSuggestInvocationGetter('d', 'X'); | 2295 assertSuggestInvocationGetter('d', 'X'); |
| 2306 assertSuggestInvocationGetter('_e', null); | 2296 assertSuggestInvocationGetter('_e', null); |
| 2307 assertSuggestInvocationGetter('f', 'X'); | 2297 assertSuggestInvocationGetter('f', 'X'); |
| 2308 assertSuggestInvocationGetter('_g', null); | 2298 assertSuggestInvocationGetter('_g', null); |
| 2309 assertSuggestInvocationSetter('s1'); | 2299 assertSuggestInvocationSetter('s1'); |
| 2310 assertSuggestInvocationSetter('_s2'); | 2300 assertSuggestInvocationSetter('_s2'); |
| 2311 assertSuggestInvocationMethod('m', 'A', null); | 2301 assertSuggestInvocationMethod('m', 'A', null); |
| 2312 assertSuggestInvocationMethod('_n', 'A', 'I'); | 2302 assertSuggestInvocationMethod('_n', 'A', 'I'); |
| 2313 assertNotSuggested('a'); | 2303 assertNotSuggested('a'); |
| 2314 assertNotSuggested('A'); | 2304 assertNotSuggested('A'); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2348 addSource('/testB.dart', ''' | 2338 addSource('/testB.dart', ''' |
| 2349 lib B; | 2339 lib B; |
| 2350 class _W {M y; var _z;} | 2340 class _W {M y; var _z;} |
| 2351 class X extends _W {} | 2341 class X extends _W {} |
| 2352 class M{}'''); | 2342 class M{}'''); |
| 2353 addTestSource(''' | 2343 addTestSource(''' |
| 2354 import "/testB.dart"; | 2344 import "/testB.dart"; |
| 2355 foo(X x) {x.^}'''); | 2345 foo(X x) {x.^}'''); |
| 2356 computeFast(); | 2346 computeFast(); |
| 2357 return computeFull((bool result) { | 2347 return computeFull((bool result) { |
| 2358 assertSuggestInvocationGetter('y', 'M'); | 2348 assertSuggestInvocationField('y', 'M'); |
| 2359 assertNotSuggested('_z'); | 2349 assertNotSuggested('_z'); |
| 2360 assertNotSuggested('=='); | 2350 assertNotSuggested('=='); |
| 2361 }); | 2351 }); |
| 2362 } | 2352 } |
| 2363 | 2353 |
| 2364 test_PrefixedIdentifier_prefix() { | 2354 test_PrefixedIdentifier_prefix() { |
| 2365 // SimpleIdentifier PrefixedIdentifier ExpressionStatement | 2355 // SimpleIdentifier PrefixedIdentifier ExpressionStatement |
| 2366 addSource('/testA.dart', ''' | 2356 addSource('/testA.dart', ''' |
| 2367 class A {static int bar = 10;} | 2357 class A {static int bar = 10;} |
| 2368 _B() {}'''); | 2358 _B() {}'''); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2434 A() {} | 2424 A() {} |
| 2435 A.z() {} | 2425 A.z() {} |
| 2436 var b; X _c; | 2426 var b; X _c; |
| 2437 X get d => new A();get _e => new A(); | 2427 X get d => new A();get _e => new A(); |
| 2438 // no semicolon between completion point and next statement | 2428 // no semicolon between completion point and next statement |
| 2439 set s1(I x) {} set _s2(I x) {this.^ m(null);} | 2429 set s1(I x) {} set _s2(I x) {this.^ m(null);} |
| 2440 m(X x) {} I _n(X x) {}} | 2430 m(X x) {} I _n(X x) {}} |
| 2441 class X{}'''); | 2431 class X{}'''); |
| 2442 computeFast(); | 2432 computeFast(); |
| 2443 return computeFull((bool result) { | 2433 return computeFull((bool result) { |
| 2444 assertSuggestInvocationGetter('b', null); | 2434 assertSuggestInvocationField('b', null); |
| 2445 assertSuggestInvocationGetter('_c', 'X'); | 2435 assertSuggestInvocationField('_c', 'X'); |
| 2446 assertSuggestInvocationGetter('d', 'X'); | 2436 assertSuggestInvocationGetter('d', 'X'); |
| 2447 assertSuggestInvocationGetter('_e', null); | 2437 assertSuggestInvocationGetter('_e', null); |
| 2448 assertSuggestInvocationGetter('f', 'X'); | 2438 assertSuggestInvocationGetter('f', 'X'); |
| 2449 assertSuggestInvocationGetter('_g', null); | 2439 assertSuggestInvocationGetter('_g', null); |
| 2450 assertSuggestInvocationMethod('m', 'A', null); | 2440 assertSuggestInvocationMethod('m', 'A', null); |
| 2451 assertSuggestInvocationMethod('_n', 'A', 'I'); | 2441 assertSuggestInvocationMethod('_n', 'A', 'I'); |
| 2452 assertSuggestInvocationSetter('s1'); | 2442 assertSuggestInvocationSetter('s1'); |
| 2453 assertSuggestInvocationSetter('_s2'); | 2443 assertSuggestInvocationSetter('_s2'); |
| 2454 assertNotSuggested('z'); | 2444 assertNotSuggested('z'); |
| 2455 assertNotSuggested('I'); | 2445 assertNotSuggested('I'); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2469 A() {this.^} | 2459 A() {this.^} |
| 2470 A.z() {} | 2460 A.z() {} |
| 2471 var b; X _c; | 2461 var b; X _c; |
| 2472 X get d => new A();get _e => new A(); | 2462 X get d => new A();get _e => new A(); |
| 2473 // no semicolon between completion point and next statement | 2463 // no semicolon between completion point and next statement |
| 2474 set s1(I x) {} set _s2(I x) {m(null);} | 2464 set s1(I x) {} set _s2(I x) {m(null);} |
| 2475 m(X x) {} I _n(X x) {}} | 2465 m(X x) {} I _n(X x) {}} |
| 2476 class X{}'''); | 2466 class X{}'''); |
| 2477 computeFast(); | 2467 computeFast(); |
| 2478 return computeFull((bool result) { | 2468 return computeFull((bool result) { |
| 2479 assertSuggestInvocationGetter('b', null); | 2469 assertSuggestInvocationField('b', null); |
| 2480 assertSuggestInvocationGetter('_c', 'X'); | 2470 assertSuggestInvocationField('_c', 'X'); |
| 2481 assertSuggestInvocationGetter('d', 'X'); | 2471 assertSuggestInvocationGetter('d', 'X'); |
| 2482 assertSuggestInvocationGetter('_e', null); | 2472 assertSuggestInvocationGetter('_e', null); |
| 2483 assertSuggestInvocationGetter('f', 'X'); | 2473 assertSuggestInvocationGetter('f', 'X'); |
| 2484 assertSuggestInvocationGetter('_g', null); | 2474 assertSuggestInvocationGetter('_g', null); |
| 2485 assertSuggestInvocationMethod('m', 'A', null); | 2475 assertSuggestInvocationMethod('m', 'A', null); |
| 2486 assertSuggestInvocationMethod('_n', 'A', 'I'); | 2476 assertSuggestInvocationMethod('_n', 'A', 'I'); |
| 2487 assertSuggestInvocationSetter('s1'); | 2477 assertSuggestInvocationSetter('s1'); |
| 2488 assertSuggestInvocationSetter('_s2'); | 2478 assertSuggestInvocationSetter('_s2'); |
| 2489 assertNotSuggested('z'); | 2479 assertNotSuggested('z'); |
| 2490 assertNotSuggested('I'); | 2480 assertNotSuggested('I'); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2581 assertNotSuggested('bar2'); | 2571 assertNotSuggested('bar2'); |
| 2582 assertNotSuggested('_B'); | 2572 assertNotSuggested('_B'); |
| 2583 assertSuggestLocalClass('Y'); | 2573 assertSuggestLocalClass('Y'); |
| 2584 assertSuggestLocalClass('C'); | 2574 assertSuggestLocalClass('C'); |
| 2585 assertSuggestLocalVariable('f', null); | 2575 assertSuggestLocalVariable('f', null); |
| 2586 assertNotSuggested('x'); | 2576 assertNotSuggested('x'); |
| 2587 assertNotSuggested('e'); | 2577 assertNotSuggested('e'); |
| 2588 }); | 2578 }); |
| 2589 } | 2579 } |
| 2590 } | 2580 } |
| OLD | NEW |