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

Unified Diff: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart

Issue 1498523005: Extract Local refactoring: skip method names in invocations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/extract_local_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
index c865aec72eec276336d43c3be9b09ae729e72a28..b9510002c57f07a89c32b408974b643a6fd0ed09 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
@@ -207,17 +207,15 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl
// fatal selection problems
if (coveringExpressionOffsets.isEmpty) {
if (node is SimpleIdentifier) {
- Element element = node.bestElement;
- if (element is FunctionElement || element is MethodElement) {
- return new RefactoringStatus.fatal(
- 'Cannot extract a single method name.',
- newLocation_fromNode(node));
- }
if (node.inDeclarationContext()) {
return new RefactoringStatus.fatal(
'Cannot extract the name part of a declaration.',
newLocation_fromNode(node));
}
+ Element element = node.bestElement;
+ if (element is FunctionElement || element is MethodElement) {
+ continue;
+ }
}
if (parent is AssignmentExpression && parent.leftHandSide == node) {
return new RefactoringStatus.fatal(
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/extract_local_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698