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

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

Issue 1496363002: Skip assignments and argument lists. (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 b9510002c57f07a89c32b408974b643a6fd0ed09..ad42a6eb27d8e9f9f1cc34959163bfe2c0630108 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
@@ -197,8 +197,18 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl
AstNode coveringNode = new NodeLocator(
selectionRange.offset, selectionRange.end).searchWithin(unit);
// compute covering expressions
- for (AstNode node = coveringNode; node is Expression; node = node.parent) {
+ for (AstNode node = coveringNode;
+ node is Expression || node is ArgumentList;
+ node = node.parent) {
AstNode parent = node.parent;
+ // skip ArgumentList
+ if (node is ArgumentList) {
+ continue;
+ }
+ // skip AssignmentExpression
+ if (node is AssignmentExpression) {
+ continue;
+ }
// cannot extract the name part of a property access
if (parent is PrefixedIdentifier && parent.identifier == node ||
parent is PropertyAccess && parent.propertyName == node) {
« 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