Skip to content

Commit d5a860e

Browse files
bwilkersonCommit Queue
authored andcommitted
[Migrate] analysis_session.dart
Two of the methods were not being referenced, so I removed them and the tests for them. Change-Id: Ic1b9bb526b3a1ff3426c35b43daa4b4750c1f089 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402904 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 499a34a commit d5a860e

File tree

4 files changed

+2
-150
lines changed

4 files changed

+2
-150
lines changed

pkg/analyzer/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ lib/src/summary2/variance_builder.dart
144144
lib/src/test_utilities/find_element.dart
145145
lib/src/test_utilities/find_node.dart
146146
lib/src/test_utilities/mock_sdk_elements.dart
147-
lib/src/utilities/extensions/analysis_session.dart
148147
lib/src/utilities/extensions/ast.dart
149148
lib/src/utilities/extensions/element.dart
150149
lib/src/utilities/extensions/flutter.dart

pkg/analyzer/lib/src/utilities/extensions/analysis_session.dart

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
import 'package:analyzer/dart/analysis/results.dart';
66
import 'package:analyzer/dart/analysis/session.dart';
7-
import 'package:analyzer/dart/element/element.dart';
8-
import 'package:analyzer/dart/element/element2.dart';
9-
import 'package:analyzer/src/utilities/extensions/element.dart';
10-
import 'package:analyzer/src/utilities/extensions/library_element.dart';
117

128
extension AnalysisSessionExtension on AnalysisSession {
139
/// Return the resolved library for the library containing the file with the
@@ -19,40 +15,9 @@ extension AnalysisSessionExtension on AnalysisSession {
1915
if (unitElement is! UnitElementResult) {
2016
return null;
2117
}
22-
var libraryPath = unitElement.element.library.source.fullName;
18+
var libraryPath =
19+
unitElement.fragment.element.firstFragment.source.fullName;
2320
var result = await getResolvedLibrary(libraryPath);
2421
return result is ResolvedLibraryResult ? result : null;
2522
}
26-
27-
/// Locates the [Element] that [location] represents.
28-
///
29-
/// Local elements such as variables inside functions cannot be found using
30-
/// this method.
31-
///
32-
/// Returns `null` if the element cannot be found.
33-
Future<Element?> locateElement(ElementLocation location) async {
34-
var components = location.components;
35-
if (location.components.isEmpty) {
36-
return null;
37-
}
38-
39-
// The first component is the library which we'll use to start the search.
40-
var libraryUri = components.first;
41-
var result = await getLibraryByUri(libraryUri);
42-
return result is LibraryElementResult
43-
? result.element.locateElement(location)
44-
: null;
45-
}
46-
47-
/// Returns the element represented by the [location].
48-
///
49-
/// Local elements such as variables inside functions can't be found using
50-
/// this method.
51-
///
52-
/// Returns `null` if the element cannot be found.
53-
Future<Element2?> locateElement2(ElementLocation location) async {
54-
var result = await locateElement(location);
55-
if (result == null) return null;
56-
return result.asElement2;
57-
}
5823
}

pkg/analyzer/test/src/utilities/extensions/analysis_session_test.dart

Lines changed: 0 additions & 110 deletions
This file was deleted.

pkg/analyzer/test/src/utilities/extensions/test_all.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'package:test_reflective_loader/test_reflective_loader.dart';
66

7-
import 'analysis_session_test.dart' as analysis_session;
87
import 'ast_test.dart' as ast;
98
import 'async_test.dart' as async;
109
import 'collection_test.dart' as collection;
@@ -15,7 +14,6 @@ import 'string_test.dart' as string;
1514

1615
main() {
1716
defineReflectiveSuite(() {
18-
analysis_session.main();
1917
ast.main();
2018
async.main();
2119
collection.main();

0 commit comments

Comments
 (0)