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

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

Issue 921833002: Issue 22381. Fix for navigating to constructor from redirecting factory constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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/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 3061df40a1fb49096ecfbf003474c4cb611dadf8..b53398e2bf505e2579f18803d5fd721e6bad7b2e 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -400,8 +400,8 @@ class _RefactoringManager {
* Initializes this context to perform a refactoring with the specified
* parameters. The existing [Refactoring] is reused or created as needed.
*/
- Future _init(RefactoringKind kind, String file,
- int offset, int length) async {
+ Future _init(RefactoringKind kind, String file, int offset,
+ int length) async {
await server.onAnalysisComplete;
// check if we can continue with the existing Refactoring instance
if (this.kind == kind &&
@@ -488,13 +488,11 @@ class _RefactoringManager {
if (element is FieldFormalParameterElement) {
element = (element as FieldFormalParameterElement).field;
}
- // 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;
+ // climb from "Class" in "new Class.named()" to "Class.named"
+ if (node.parent is TypeName && node.parent.parent is ConstructorName) {
+ ConstructorName constructor = node.parent.parent;
+ node = constructor;
+ element = constructor.staticElement;
}
// do create the refactoring
refactoring = new RenameRefactoring(searchEngine, element);

Powered by Google App Engine
This is Rietveld 408576698