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

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

Issue 2669353002: Stop using Element.computeNode() in refactorings and fixes. (Closed)
Patch Set: documentation comments Created 3 years, 11 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
Index: pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
index 68acb96b2046888e7b414d603b552b1326ba160f..3883df31e1d53d1b68e975bdd4774fb3e531459b 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
@@ -20,6 +20,7 @@ import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
+import 'package:analyzer/src/dart/element/ast_provider.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
@@ -196,7 +197,7 @@ Set<String> _getNamesConflictingAt(AstNode node) {
class InlineMethodRefactoringImpl extends RefactoringImpl
implements InlineMethodRefactoring {
final SearchEngine searchEngine;
- final GetResolvedUnit getResolvedUnit;
+ final AstProvider astProvider;
final CompilationUnit unit;
final int offset;
_UnitCache _unitCache;
@@ -221,8 +222,8 @@ class InlineMethodRefactoringImpl extends RefactoringImpl
Set<FunctionBody> _alreadyMadeAsync = new Set<FunctionBody>();
InlineMethodRefactoringImpl(
- this.searchEngine, this.getResolvedUnit, this.unit, this.offset) {
- _unitCache = new _UnitCache(getResolvedUnit, unit);
+ this.searchEngine, this.astProvider, this.unit, this.offset) {
+ _unitCache = new _UnitCache(astProvider, unit);
utils = new CorrectionUtils(unit);
}
@@ -789,10 +790,10 @@ class _SourcePart {
}
class _UnitCache {
- final GetResolvedUnit getResolvedUnit;
+ final AstProvider astProvider;
final Map<CompilationUnitElement, CompilationUnit> map = {};
- _UnitCache(this.getResolvedUnit, CompilationUnit unit) {
+ _UnitCache(this.astProvider, CompilationUnit unit) {
map[unit.element] = unit;
}
@@ -801,7 +802,7 @@ class _UnitCache {
element.getAncestor((e) => e is CompilationUnitElement);
CompilationUnit unit = map[unitElement];
if (unit == null) {
- unit = unitElement.unit;
+ unit = await astProvider.getResolvedUnitForElement(element);
map[unitElement] = unit;
}
return unit;

Powered by Google App Engine
This is Rietveld 408576698