@@ -217,8 +217,6 @@ private OperationStatus GetOperationStatus(
217217 ? OperationStatus . UnsafeAddressTaken
218218 : OperationStatus . SucceededStatus ;
219219
220- var asyncRefOutParameterStatus = CheckAsyncMethodRefOutParameters ( variables ) ;
221-
222220 var variableMapStatus = failedVariables . Count == 0
223221 ? OperationStatus . SucceededStatus
224222 : new OperationStatus ( succeeded : true ,
@@ -230,25 +228,11 @@ private OperationStatus GetOperationStatus(
230228 ? OperationStatus . LocalFunctionCallWithoutDeclaration
231229 : OperationStatus . SucceededStatus ;
232230
233- return readonlyFieldStatus . With ( anonymousTypeStatus )
234- . With ( unsafeAddressStatus )
235- . With ( asyncRefOutParameterStatus )
236- . With ( variableMapStatus )
237- . With ( localFunctionStatus ) ;
238- }
239-
240- private OperationStatus CheckAsyncMethodRefOutParameters ( IList < VariableInfo > parameters )
241- {
242- if ( SelectionResult . CreateAsyncMethod ( ) )
243- {
244- var names = parameters . Where ( v => v is { UseAsReturnValue : false , ParameterModifier : ParameterBehavior . Out or ParameterBehavior . Ref } )
245- . Select ( p => p . Name ?? string . Empty ) ;
246-
247- if ( names . Any ( ) )
248- return new OperationStatus ( succeeded : true , string . Format ( FeaturesResources . Asynchronous_method_cannot_have_ref_out_parameters_colon_bracket_0_bracket , string . Join ( ", " , names ) ) ) ;
249- }
250-
251- return OperationStatus . SucceededStatus ;
231+ return readonlyFieldStatus
232+ . With ( anonymousTypeStatus )
233+ . With ( unsafeAddressStatus )
234+ . With ( variableMapStatus )
235+ . With ( localFunctionStatus ) ;
252236 }
253237
254238 private MultiDictionary < ISymbol , SyntaxToken > GetSymbolMap ( )
@@ -286,7 +270,7 @@ private ImmutableArray<VariableInfo> MarkVariableInfosToUseAsReturnValueIfPossib
286270 // return values of the method since we can't actually have out/ref with an async method.
287271 var outRefCount = numberOfOutParameters + numberOfRefParameters ;
288272 if ( outRefCount > 0 &&
289- this . SelectionResult . CreateAsyncMethod ( ) &&
273+ this . SelectionResult . ContainsAwaitExpression ( ) &&
290274 this . SyntaxFacts . SupportsTupleDeconstruction ( this . SemanticDocument . Document . Project . ParseOptions ! ) )
291275 {
292276 var result = new FixedSizeArrayBuilder < VariableInfo > ( variableInfo . Length ) ;
0 commit comments