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; |