Skip to content

Commit e9d03a0

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Update FindElement2 to work with elements, not fragments.
Related to: https://dart-review.googlesource.com/c/sdk/+/390812 No more `Fragment.name2` uses in `FindElement2`. Change-Id: Idb5e766f4ced1b63bb2154d6fb1bdf5582011d73 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390633 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent d75d1f6 commit e9d03a0

File tree

9 files changed

+126
-142
lines changed

9 files changed

+126
-142
lines changed

pkg/analysis_server/test/abstract_single_unit.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:analyzer/error/error.dart';
99
import 'package:analyzer/file_system/file_system.dart';
1010
import 'package:analyzer/src/error/codes.g.dart';
1111
import 'package:analyzer/src/test_utilities/find_element.dart';
12-
import 'package:analyzer/src/test_utilities/find_element_2.dart';
12+
import 'package:analyzer/src/test_utilities/find_element2.dart';
1313
import 'package:analyzer/src/test_utilities/find_node.dart';
1414
import 'package:test/test.dart';
1515

pkg/analysis_server/test/services/search/search_engine_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:analyzer/dart/analysis/results.dart';
88
import 'package:analyzer/dart/element/element.dart';
99
import 'package:analyzer/file_system/file_system.dart';
1010
import 'package:analyzer/src/test_utilities/find_element.dart';
11-
import 'package:analyzer/src/test_utilities/find_element_2.dart';
11+
import 'package:analyzer/src/test_utilities/find_element2.dart';
1212
import 'package:analyzer/src/test_utilities/find_node.dart';
1313
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
1414
import 'package:analyzer/src/util/file_paths.dart';

pkg/analyzer/lib/src/test_utilities/find_element.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,9 @@ class FindElement extends _FindElementBase {
248248

249249
PrefixElement prefix(String name) {
250250
for (var libraryFragment in unitElement.withEnclosing) {
251-
for (var import_ in libraryFragment.libraryImports) {
252-
var prefix = import_.prefix?.element;
253-
if (prefix != null && prefix.name == name) {
254-
return prefix;
251+
for (var importPrefix in libraryFragment.libraryImportPrefixes) {
252+
if (importPrefix.name == name) {
253+
return importPrefix;
255254
}
256255
}
257256
}

0 commit comments

Comments
 (0)