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

Unified Diff: pkg/analysis_services/lib/src/correction/util.dart

Issue 465733002: 'Rename Local Variable' refactoring implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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_services/lib/src/correction/util.dart
diff --git a/pkg/analysis_services/lib/src/correction/util.dart b/pkg/analysis_services/lib/src/correction/util.dart
index 6290f6dfcec365bd6c3c258b4a24a432ee51349b..3543df3240cda9d9e8ed4a798b6ae893b2328209 100644
--- a/pkg/analysis_services/lib/src/correction/util.dart
+++ b/pkg/analysis_services/lib/src/correction/util.dart
@@ -60,6 +60,30 @@ String getDefaultValueCode(DartType type) {
/**
+ * Return the name of the [Element] kind.
+ */
+String getElementKindName(Element element) {
+ return element.kind.displayName;
+}
+
+
+/**
+ * Returns the name to display in the UI for the given [Element].
+ */
+String getElementQualifiedName(Element element) {
+ ElementKind kind = element.kind;
+ while (true) {
+ if (kind == ElementKind.FIELD || kind == ElementKind.METHOD) {
+ return '${element.enclosingElement.displayName}.${element.displayName}';
+ } else {
+ return element.displayName;
+ }
+ break;
Brian Wilkerson 2014/08/12 04:44:40 I don't understand this code. We will never reach
scheglov 2014/08/12 05:09:33 /me is surprised too. I guess it was a switch/case
+ }
+}
+
+
+/**
* @return the [ExecutableElement] of the enclosing executable [AstNode].
*/
ExecutableElement getEnclosingExecutableElement(AstNode node) {
@@ -78,7 +102,6 @@ ExecutableElement getEnclosingExecutableElement(AstNode node) {
return null;
}
-
/**
* Returns a namespace of the given [ExportElement].
*/
@@ -108,7 +131,6 @@ Element getExportedElement(LibraryElement library, String name) {
return getExportNamespaceForLibrary(library)[name];
}
-
/**
* Returns [getExpressionPrecedence] for the parent of [node],
* or `0` if the parent node is [ParenthesizedExpression].
@@ -142,6 +164,7 @@ Map<String, Element> getImportNamespace(ImportElement imp) {
return namespace.definedNames;
}
+
/**
* If given [AstNode] is name of qualified property extraction, returns target from which
* this property is extracted. Otherwise `null`.
@@ -163,6 +186,7 @@ Expression getQualifiedPropertyTarget(AstNode node) {
return null;
}
+
/**
* Returns the given [Statement] if not a [Block], or the first child
* [Statement] if a [Block], or `null` if more than one child.

Powered by Google App Engine
This is Rietveld 408576698