| Index: pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
|
| index ca243c4b0673c97f2f1fa17f6b40c267787927ff..d68de947477092a705025ef737382facb5a4e749 100644
|
| --- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
|
| +++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
|
| @@ -216,6 +216,7 @@ class InlineMethodRefactoringImpl extends RefactoringImpl
|
| _SourcePart _methodExpressionPart;
|
| _SourcePart _methodStatementsPart;
|
| List<_ReferenceProcessor> _referenceProcessors = [];
|
| + Set<FunctionBody> _alreadyMadeAsync = new Set<FunctionBody>();
|
|
|
| InlineMethodRefactoringImpl(this.searchEngine, this.unit, this.offset) {
|
| utils = new CorrectionUtils(unit);
|
| @@ -560,6 +561,15 @@ class _ReferenceProcessor {
|
| if (!_shouldProcess()) {
|
| return;
|
| }
|
| + // If the element being inlined is async, ensure that the function
|
| + // body that encloses the method is also async.
|
| + if (ref._methodElement.isAsynchronous) {
|
| + FunctionBody body = _node.getAncestor((n) => n is FunctionBody);
|
| + if (!body.isAsynchronous && ref._alreadyMadeAsync.add(body)) {
|
| + SourceRange bodyStart = rangeStartLength(body.offset, 0);
|
| + _addRefEdit(newSourceEdit_range(bodyStart, 'async '));
|
| + }
|
| + }
|
| // may be invocation of inline method
|
| if (nodeParent is MethodInvocation) {
|
| MethodInvocation invocation = nodeParent;
|
|
|