| 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.search.element_references; | 5 library test.search.element_references; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/computer/element.dart'; | 9 import 'package:analysis_server/src/computer/element.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 '''); | 447 '''); |
| 448 return findElementReferences('test(p) {}', false).then((_) { | 448 return findElementReferences('test(p) {}', false).then((_) { |
| 449 assertHasResult(SearchResultKind.INVOCATION, 'test(1);'); | 449 assertHasResult(SearchResultKind.INVOCATION, 'test(1);'); |
| 450 assertNoResult(SearchResultKind.INVOCATION, 'test(2);'); | 450 assertNoResult(SearchResultKind.INVOCATION, 'test(2);'); |
| 451 }); | 451 }); |
| 452 } | 452 } |
| 453 | 453 |
| 454 test_potential_field() { | 454 test_potential_field() { |
| 455 addTestFile(''' | 455 addTestFile(''' |
| 456 class A { | 456 class A { |
| 457 test; // declaration | 457 var test; // declaration |
| 458 } | 458 } |
| 459 main(A a, p) { | 459 main(A a, p) { |
| 460 a.test = 1; | 460 a.test = 1; |
| 461 p.test = 2; | 461 p.test = 2; |
| 462 print(p.test); // p | 462 print(p.test); // p |
| 463 } | 463 } |
| 464 '''); | 464 '''); |
| 465 return findElementReferences('test; // declaration', true).then((_) { | 465 return findElementReferences('test; // declaration', true).then((_) { |
| 466 { | 466 { |
| 467 assertHasResult(SearchResultKind.WRITE, 'test = 1;'); | 467 assertHasResult(SearchResultKind.WRITE, 'test = 1;'); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 579 } |
| 580 '''); | 580 '''); |
| 581 return findElementReferences('T> {', false).then((_) { | 581 return findElementReferences('T> {', false).then((_) { |
| 582 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); | 582 expect(searchElement.kind, ElementKind.TYPE_PARAMETER); |
| 583 expect(results, hasLength(2)); | 583 expect(results, hasLength(2)); |
| 584 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); | 584 assertHasResult(SearchResultKind.REFERENCE, 'T f;'); |
| 585 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); | 585 assertHasResult(SearchResultKind.REFERENCE, 'T m()'); |
| 586 }); | 586 }); |
| 587 } | 587 } |
| 588 } | 588 } |
| OLD | NEW |