Skip to content

Add MethodImplAttributes.Async flag#571

Open
PhilippNaused wants to merge 1 commit into
0xd4d:masterfrom
PhilippNaused:runtimeAsync
Open

Add MethodImplAttributes.Async flag#571
PhilippNaused wants to merge 1 commit into
0xd4d:masterfrom
PhilippNaused:runtimeAsync

Conversation

@ElektroKill
Copy link
Copy Markdown
Contributor

MethodDef.HasReturnType could also potentially be updated to match this statement:

"Async methods also do not have matching return type conventions as sync methods. For sync methods, the stack should contain a value convertible to the stated return type before the ret instruction. For async methods, the stack should be empty in the case of Task or ValueTask, or the type argument in the case of Task<T> or ValueTask<T>."

found in https://github.com/dotnet/runtime/blob/main/docs/design/specs/runtime-async.md#i845-sync-and-async-methods

@wtfsck What do you think?

@PhilippNaused
Copy link
Copy Markdown
Author

@ElektroKill Like this?

 /// <summary>
 /// <c>true</c> if the method returns a value (i.e., return type is not <see cref="System.Void"/>)
 /// </summary>
+/// <remarks>
+/// <see cref="MethodImplAttributes.Async"/> methods also do not have matching return type conventions as sync methods.
+/// For sync methods, the stack should contain a value convertible to the stated return type before the <see cref="OpCodes.Ret"/> instruction.
+/// For async methods, the stack should be empty in the case of <c>Task</c> or <c>ValueTask</c>, or the type argument in the case of <c>Task&lt;T&gt;</c> or <c>ValueTask&lt;T&gt;</c>.
+/// <seealso href="https://github.com/dotnet/runtime/blob/main/docs/design/specs/runtime-async.md"/>
+/// </remarks>
 public bool HasReturnType => ReturnType.RemovePinnedAndModifiers().GetElementType() != ElementType.Void;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants