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

Unified Diff: pkg/analysis_server/lib/src/services/correction/util.dart

Issue 565023003: Issue 13029. Quick fix to create a function for a Function typed named parameter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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/correction/util.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index fdec5b8227502858eae7329d78745326af8cf18e..d7a7bf57c616d62cd82d274971d40271ed18a6fe 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -459,6 +459,21 @@ bool isNamedExpressionName(SimpleIdentifier node) {
}
+/**
+ * If the given [expression] is the `expression` property of a [NamedExpression]
+ * then returns this [NamedExpression]. Otherwise returns [expression].
+ */
+Expression stepUpNamedExpression(Expression expression) {
+ if (expression != null) {
+ AstNode parent = expression.parent;
+ if (parent is NamedExpression && parent.expression == expression) {
+ return parent;
+ }
+ }
+ return expression;
+}
+
+
class CorrectionUtils {
final CompilationUnit unit;

Powered by Google App Engine
This is Rietveld 408576698