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

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

Issue 2677833002: Don't search for 'declaration' of elements, just name is usually enough. (Closed)
Patch Set: Created 3 years, 10 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_local.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
index 362080afe059edbdee8fa5c63f0bdc7bb2c8ec76..74e1add2fc130bad3606b0c0cf425e6077a7d9b6 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_local.dart
@@ -37,7 +37,8 @@ class InlineLocalRefactoringImpl extends RefactoringImpl
VariableDeclaration _variableNode;
List<SearchMatch> _references;
- InlineLocalRefactoringImpl(this.searchEngine, this.astProvider, this.unit, this.offset) {
+ InlineLocalRefactoringImpl(
+ this.searchEngine, this.astProvider, this.unit, this.offset) {
unitElement = unit.element;
utils = new CorrectionUtils(unit);
}
@@ -77,7 +78,8 @@ class InlineLocalRefactoringImpl extends RefactoringImpl
Element element = offsetNode.staticElement;
if (element is LocalVariableElement) {
_variableElement = element;
- _variableNode = await astProvider.getResolvedNodeForElement(element);
+ AstNode name = await astProvider.getResolvedNameForElement(element);
+ _variableNode = name.parent as VariableDeclaration;
}
}
}

Powered by Google App Engine
This is Rietveld 408576698