Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/rename_import.dart

Issue 3007493002: Remove most of the remaining references to AnalysisContext (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/rename.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/refactoring/rename_import.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_import.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_import.dart
index 1f5ef92b0c04aae762168eb33bef5d6e133e9306..38ffe36ea7999913ebc5f13c7f5d85ddb815816a 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_import.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_import.dart
@@ -85,7 +85,7 @@ class RenameImportRefactoringImpl extends RenameRefactoringImpl {
reference.addEdit(change, '');
} else {
SimpleIdentifier interpolationIdentifier =
- _getInterpolationIdentifier(reference);
+ await _getInterpolationIdentifier(reference);
if (interpolationIdentifier != null) {
doSourceChange_addElementEdit(
change,
@@ -116,9 +116,12 @@ class RenameImportRefactoringImpl extends RenameRefactoringImpl {
* an [InterpolationExpression] without surrounding curly brackets, return it.
* Otherwise return `null`.
*/
- SimpleIdentifier _getInterpolationIdentifier(SourceReference reference) {
+ Future<SimpleIdentifier> _getInterpolationIdentifier(
+ SourceReference reference) async {
Source source = reference.element.source;
- CompilationUnit unit = context.parseCompilationUnit(source);
+ CompilationUnit unit =
+ (await astProvider.driver.currentSession.getParsedAst(source.fullName))
scheglov 2017/08/23 19:27:28 Ideally I would prefer to put each `await` into a
Brian Wilkerson 2017/08/23 19:56:52 Done
+ .unit;
NodeLocator nodeLocator = new NodeLocator(reference.range.offset);
AstNode node = nodeLocator.searchWithin(unit);
if (node is SimpleIdentifier) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/rename.dart ('k') | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698