Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/DotNet/MethodDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,12 @@ public TypeSig ReturnType {
/// <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;

/// <summary>
Expand Down Expand Up @@ -855,6 +861,14 @@ public bool HasSecurityMitigations {
set => ModifyImplAttributes(value, MethodImplAttributes.SecurityMitigations);
}

/// <summary>
/// Gets/sets the <see cref="MethodImplAttributes.Async"/> bit
/// </summary>
public bool IsAsync {
get => ((MethodImplAttributes)implAttributes & MethodImplAttributes.Async) != 0;
set => ModifyImplAttributes(value, MethodImplAttributes.Async);
}

/// <summary>
/// Gets/sets the <see cref="MethodSemanticsAttributes.Setter"/> bit
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions src/DotNet/MethodImplAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ public enum MethodImplAttributes : ushort {
AggressiveOptimization = 0x0200,
/// <summary>The JIT compiler should look for security mitigation attributes, such as the user-defined System.Runtime.CompilerServices.SecurityMitigationsAttribute. If found, the JIT compiler applies any related security mitigations. Available starting with .NET Framework 4.8.</summary>
SecurityMitigations = 0x0400,
/// <summary>Method requires async state machine rewrite. Available starting with .NET 11.0.</summary>
Async = 0x2000,
}
}
Loading