Skip to content

Commit 156ff66

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Migrate FindElement2.
Change-Id: Ia5b901fbe8a7666a829628dcf9056c35e99f20bd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396460 Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent dcee4f2 commit 156ff66

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

pkg/analyzer/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ lib/src/summary2/types_builder.dart
160160
lib/src/summary2/variance_builder.dart
161161
lib/src/task/strong_mode.dart
162162
lib/src/test_utilities/find_element.dart
163-
lib/src/test_utilities/find_element2.dart
164163
lib/src/test_utilities/find_node.dart
165164
lib/src/test_utilities/mock_sdk_elements.dart
166165
lib/src/util/ast_data_extractor.dart

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@ abstract class DirectiveUriWithSource extends DirectiveUriWithRelativeUri {
546546
///
547547
/// Clients may not extend, implement or mix-in this class.
548548
abstract class DirectiveUriWithUnit extends DirectiveUriWithSource {
549+
/// The library fragment referenced by the [source].
550+
@experimental
551+
LibraryFragment get libraryFragment;
552+
549553
/// The unit referenced by the [source].
550554
CompilationUnitElement get unit;
551555
}

pkg/analyzer/lib/dart/element/element2.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import 'package:analyzer/dart/constant/value.dart';
5252
import 'package:analyzer/dart/element/element.dart'
5353
show
5454
DirectiveUri,
55-
DirectiveUriWithUnit,
5655
ElementAnnotation,
5756
ElementKind,
5857
ElementLocation,
@@ -2582,8 +2581,3 @@ abstract class VariableFragment implements Fragment {
25822581
@override
25832582
VariableFragment? get previousFragment;
25842583
}
2585-
2586-
extension DirectiveUriWithUnitExtension on DirectiveUriWithUnit {
2587-
/// The library fragment associated with this directive.
2588-
LibraryFragment get libraryFragment => unit as LibraryFragment;
2589-
}

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,9 @@ class DirectiveUriWithUnitImpl extends DirectiveUriWithRelativeUriImpl
19131913
required this.unit,
19141914
});
19151915

1916+
@override
1917+
LibraryFragment get libraryFragment => unit;
1918+
19161919
@override
19171920
Source get source => unit.source;
19181921
}

pkg/linter/lib/src/rules/analyzer_use_new_elements.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ bool _isOldModelElement(Element2? element) {
3535
'DirectiveUriWithRelativeUri',
3636
'DirectiveUriWithRelativeUriString',
3737
'DirectiveUriWithSource',
38+
'DirectiveUriWithUnit',
3839
'ElementAnnotation',
3940
'ElementKind',
4041
'ElementLocation',

0 commit comments

Comments
 (0)