| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/analysis/driver.dart'; | 10 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 test_searchReferences_LocalVariableElement() async { | 606 test_searchReferences_LocalVariableElement() async { |
| 607 await _resolveTestUnit(r''' | 607 await _resolveTestUnit(r''' |
| 608 main() { | 608 main() { |
| 609 var v; | 609 var v; |
| 610 v = 1; | 610 v = 1; |
| 611 v += 2; | 611 v += 2; |
| 612 print(v); | 612 print(v); |
| 613 v(); | 613 v(); |
| 614 } | 614 } |
| 615 '''); | 615 '''); |
| 616 Element element = _findElement('v'); | 616 Element element = _findElementAtString('v;'); |
| 617 Element main = _findElement('main'); | 617 Element main = _findElement('main'); |
| 618 var expected = [ | 618 var expected = [ |
| 619 _expectId(main, SearchResultKind.WRITE, 'v = 1;'), | 619 _expectId(main, SearchResultKind.WRITE, 'v = 1;'), |
| 620 _expectId(main, SearchResultKind.READ_WRITE, 'v += 2;'), | 620 _expectId(main, SearchResultKind.READ_WRITE, 'v += 2;'), |
| 621 _expectId(main, SearchResultKind.READ, 'v);'), | 621 _expectId(main, SearchResultKind.READ, 'v);'), |
| 622 _expectId(main, SearchResultKind.INVOCATION, 'v();') | 622 _expectId(main, SearchResultKind.INVOCATION, 'v();') |
| 623 ]; | 623 ]; |
| 624 await _verifyReferences(element, expected); | 624 await _verifyReferences(element, expected); |
| 625 } | 625 } |
| 626 | 626 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 List<SearchResult> results = await driver.search.references(element); | 1265 List<SearchResult> results = await driver.search.references(element); |
| 1266 _assertResults(results, expectedMatches); | 1266 _assertResults(results, expectedMatches); |
| 1267 expect(results, hasLength(expectedMatches.length)); | 1267 expect(results, hasLength(expectedMatches.length)); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 static void _assertResults( | 1270 static void _assertResults( |
| 1271 List<SearchResult> matches, List<ExpectedResult> expectedMatches) { | 1271 List<SearchResult> matches, List<ExpectedResult> expectedMatches) { |
| 1272 expect(matches, unorderedEquals(expectedMatches)); | 1272 expect(matches, unorderedEquals(expectedMatches)); |
| 1273 } | 1273 } |
| 1274 } | 1274 } |
| OLD | NEW |