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

Unified Diff: editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java

Issue 250823006: Translate parts of engine.services project. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to pkg/analysis_services/ Created 6 years, 8 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: editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java
diff --git a/editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java b/editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java
index b4a45b4fd151e28c8b68d54a5bcb46f56e0d5b0b..f6a06196d64896f5f51e7279ec90d391d6fced89 100644
--- a/editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java
+++ b/editor/tools/plugins/com.google.dart.engine.services/src/com/google/dart/engine/services/internal/refactoring/InlineLocalRefactoringImpl.java
@@ -84,9 +84,9 @@ public class InlineLocalRefactoringImpl extends RefactoringImpl implements Inlin
Element element = coveringIdentifier.getBestElement();
if (element instanceof LocalVariableElement) {
variableElement = (LocalVariableElement) element;
- variableNode = utils.findNode(
- variableElement.getNameOffset(),
- VariableDeclaration.class);
+ AstNode variableElementNode = utils.findNode(variableElement.getNameOffset());
+ variableNode = variableElementNode != null
+ ? variableElementNode.getAncestor(VariableDeclaration.class) : null;
}
}
}
@@ -106,9 +106,8 @@ public class InlineLocalRefactoringImpl extends RefactoringImpl implements Inlin
String message = MessageFormat.format(
"Local variable ''{0}'' is not initialized at declaration.",
variableElement.getDisplayName());
- return RefactoringStatus.createFatalErrorStatus(
- message,
- RefactoringStatusContext.create(variableNode));
+ return RefactoringStatus.createFatalErrorStatus(message, new RefactoringStatusContext(
+ variableNode));
}
pm.worked(1);
// should not have assignments
@@ -205,7 +204,7 @@ public class InlineLocalRefactoringImpl extends RefactoringImpl implements Inlin
* @return <code>true</code> if given offset of the reference has form <code>$name</code>.
*/
private boolean isIdentifierInStringInterpolation(int offset) {
- AstNode node = utils.findNode(offset, AstNode.class);
+ AstNode node = utils.findNode(offset);
AstNode parent = node.getParent();
if (parent instanceof InterpolationExpression) {
InterpolationExpression element = (InterpolationExpression) parent;

Powered by Google App Engine
This is Rietveld 408576698