Skip to content

Commit 73adec7

Browse files
bwilkersonCommit Queue
authored andcommitted
Migrate bulk_fix_processor.dart
Change-Id: I5385c0237d37ddf808609897dc846f100b11cd5e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395703 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 5c904c1 commit 73adec7

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

pkg/analysis_server/analyzer_use_new_elements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ lib/src/services/completion/dart/utilities.dart
4747
lib/src/services/completion/dart/visibility_tracker.dart
4848
lib/src/services/completion/postfix/postfix_completion.dart
4949
lib/src/services/completion/statement/statement_completion.dart
50-
lib/src/services/correction/bulk_fix_processor.dart
5150
lib/src/services/correction/dart/add_extension_override.dart
5251
lib/src/services/correction/dart/create_extension_member.dart
5352
lib/src/services/correction/dart/import_library.dart

pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ class BulkFixProcessor {
527527
if (library is NotLibraryButPartResult) {
528528
var unit = await context.currentSession.getResolvedUnit(path);
529529
if (unit is ResolvedUnitResult) {
530-
library = await context.currentSession.getResolvedLibraryByElement(
531-
unit.libraryElement,
530+
library = await context.currentSession.getResolvedLibraryByElement2(
531+
unit.libraryElement2,
532532
);
533533
}
534534
}

pkg/analyzer/lib/dart/analysis/session.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import 'package:analyzer/dart/analysis/declared_variables.dart';
77
import 'package:analyzer/dart/analysis/results.dart';
88
import 'package:analyzer/dart/analysis/uri_converter.dart';
99
import 'package:analyzer/dart/element/element.dart';
10+
import 'package:analyzer/dart/element/element2.dart';
1011
import 'package:analyzer/exception/exception.dart';
1112
import 'package:analyzer/file_system/file_system.dart';
13+
import 'package:meta/meta.dart';
1214

1315
/// A consistent view of the results of analyzing one or more files.
1416
///
@@ -69,6 +71,14 @@ abstract class AnalysisSession {
6971
Future<SomeResolvedLibraryResult> getResolvedLibraryByElement(
7072
LibraryElement element);
7173

74+
/// Return a future that will complete with information about the results of
75+
/// resolving all of the files in the library with the library [element].
76+
///
77+
/// Throw [ArgumentError] if the [element] was not produced by this session.
78+
@experimental
79+
Future<SomeResolvedLibraryResult> getResolvedLibraryByElement2(
80+
LibraryElement2 element);
81+
7282
/// Return a future that will complete with information about the results of
7383
/// resolving the file with the given absolute, normalized [path].
7484
Future<SomeResolvedUnitResult> getResolvedUnit(String path);

pkg/analyzer/lib/src/dart/analysis/session.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:analyzer/dart/analysis/results.dart';
88
import 'package:analyzer/dart/analysis/session.dart';
99
import 'package:analyzer/dart/analysis/uri_converter.dart';
1010
import 'package:analyzer/dart/element/element.dart';
11+
import 'package:analyzer/dart/element/element2.dart';
1112
import 'package:analyzer/file_system/file_system.dart';
1213
import 'package:analyzer/src/dart/analysis/driver.dart' as driver;
1314
import 'package:analyzer/src/dart/analysis/uri_converter.dart';
@@ -128,6 +129,19 @@ class AnalysisSessionImpl implements AnalysisSession {
128129
return await _driver.getResolvedLibraryByUri(element.source.uri);
129130
}
130131

132+
@override
133+
Future<SomeResolvedLibraryResult> getResolvedLibraryByElement2(
134+
LibraryElement2 element,
135+
) async {
136+
checkConsistency();
137+
138+
if (element.session != this) {
139+
return NotElementOfThisSessionResult();
140+
}
141+
142+
return await _driver.getResolvedLibraryByUri(element.uri);
143+
}
144+
131145
@override
132146
Future<SomeResolvedUnitResult> getResolvedUnit(String path) async {
133147
checkConsistency();

0 commit comments

Comments
 (0)