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

Unified Diff: pkg/analysis_server/lib/src/edit/edit_domain.dart

Issue 717513003: Issue 21552. Fixes for navigation, hover and rename in instance creation expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/edit/edit_domain.dart
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index f6e91a14ca1eaa44358d0c36c7a3445d5fdfb290..693200e80fc941e09b0867ecc2c54b6b32e1dd84 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -372,6 +372,15 @@ class _RefactoringManager {
if (nodes.isNotEmpty && elements.isNotEmpty) {
AstNode node = nodes[0];
Element element = elements[0];
+ // climb from "Class" in "new Class()" to "new Class()"
+ if (node.parent is TypeName &&
+ node.parent.parent is ConstructorName &&
+ node.parent.parent.parent is InstanceCreationExpression) {
+ InstanceCreationExpression creation = node.parent.parent.parent;
+ node = creation;
+ element = creation.staticElement;
+ }
+ // do create the refactoring
refactoring = new RenameRefactoring(searchEngine, element);
feedback =
new RenameFeedback(node.offset, node.length, 'kind', 'oldName');

Powered by Google App Engine
This is Rietveld 408576698