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

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

Issue 1528023002: Issue 25252. Stop collecting covering expressions at void 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 cd35e64da8e4573902ce5270da7ebb6698bff9d8..d24ccd9496fd17b61079ae5cc72f613ccd6a2e9f 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_local.dart
@@ -232,6 +232,21 @@ class ExtractLocalRefactoringImpl extends RefactoringImpl
node is Expression || node is ArgumentList;
node = node.parent) {
AstNode parent = node.parent;
+ // stop at void method invocations
+ if (node is MethodInvocation) {
+ MethodInvocation invocation = node;
+ Element element = invocation.methodName.bestElement;
+ if (element is ExecutableElement &&
+ element.returnType != null &&
+ element.returnType.isVoid) {
+ if (rootExpression == null) {
+ return new RefactoringStatus.fatal(
+ 'Cannot extract the void expression.',
+ newLocation_fromNode(node));
+ }
+ break;
+ }
+ }
// skip ArgumentList
if (node is ArgumentList) {
continue;
« 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