File tree Expand file tree Collapse file tree 4 files changed +26
-3
lines changed
lib/src/services/correction Expand file tree Collapse file tree 4 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ lib/src/services/completion/dart/utilities.dart
4747lib/src/services/completion/dart/visibility_tracker.dart
4848lib/src/services/completion/postfix/postfix_completion.dart
4949lib/src/services/completion/statement/statement_completion.dart
50- lib/src/services/correction/bulk_fix_processor.dart
5150lib/src/services/correction/dart/add_extension_override.dart
5251lib/src/services/correction/dart/create_extension_member.dart
5352lib/src/services/correction/dart/import_library.dart
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ import 'package:analyzer/dart/analysis/declared_variables.dart';
77import 'package:analyzer/dart/analysis/results.dart' ;
88import 'package:analyzer/dart/analysis/uri_converter.dart' ;
99import 'package:analyzer/dart/element/element.dart' ;
10+ import 'package:analyzer/dart/element/element2.dart' ;
1011import 'package:analyzer/exception/exception.dart' ;
1112import '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);
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import 'package:analyzer/dart/analysis/results.dart';
88import 'package:analyzer/dart/analysis/session.dart' ;
99import 'package:analyzer/dart/analysis/uri_converter.dart' ;
1010import 'package:analyzer/dart/element/element.dart' ;
11+ import 'package:analyzer/dart/element/element2.dart' ;
1112import 'package:analyzer/file_system/file_system.dart' ;
1213import 'package:analyzer/src/dart/analysis/driver.dart' as driver;
1314import '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 ();
You can’t perform that action at this time.
0 commit comments