Skip to content

Commit

Permalink
Elements. Update FindElement2 to work with elements, not fragments.
Browse files Browse the repository at this point in the history
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 <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
scheglov authored and Commit Queue committed Oct 21, 2024
1 parent d75d1f6 commit e9d03a0
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 142 deletions.
2 changes: 1 addition & 1 deletion pkg/analysis_server/test/abstract_single_unit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:analyzer/error/error.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/error/codes.g.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:analyzer/src/test_utilities/find_element_2.dart';
import 'package:analyzer/src/test_utilities/find_element2.dart';
import 'package:analyzer/src/test_utilities/find_node.dart';
import 'package:test/test.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/test_utilities/find_element.dart';
import 'package:analyzer/src/test_utilities/find_element_2.dart';
import 'package:analyzer/src/test_utilities/find_element2.dart';
import 'package:analyzer/src/test_utilities/find_node.dart';
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
import 'package:analyzer/src/util/file_paths.dart';
Expand Down
7 changes: 3 additions & 4 deletions pkg/analyzer/lib/src/test_utilities/find_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,9 @@ class FindElement extends _FindElementBase {

PrefixElement prefix(String name) {
for (var libraryFragment in unitElement.withEnclosing) {
for (var import_ in libraryFragment.libraryImports) {
var prefix = import_.prefix?.element;
if (prefix != null && prefix.name == name) {
return prefix;
for (var importPrefix in libraryFragment.libraryImportPrefixes) {
if (importPrefix.name == name) {
return importPrefix;
}
}
}
Expand Down
Loading

0 comments on commit e9d03a0

Please sign in to comment.