diff --git a/src/DotNet/MethodDef.cs b/src/DotNet/MethodDef.cs index 1411eb1a..1821508e 100644 --- a/src/DotNet/MethodDef.cs +++ b/src/DotNet/MethodDef.cs @@ -498,6 +498,12 @@ public TypeSig ReturnType { /// /// true if the method returns a value (i.e., return type is not ) /// + /// + /// 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 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>. + /// + /// public bool HasReturnType => ReturnType.RemovePinnedAndModifiers().GetElementType() != ElementType.Void; /// @@ -855,6 +861,14 @@ public bool HasSecurityMitigations { set => ModifyImplAttributes(value, MethodImplAttributes.SecurityMitigations); } + /// + /// Gets/sets the bit + /// + public bool IsAsync { + get => ((MethodImplAttributes)implAttributes & MethodImplAttributes.Async) != 0; + set => ModifyImplAttributes(value, MethodImplAttributes.Async); + } + /// /// Gets/sets the bit /// diff --git a/src/DotNet/MethodImplAttributes.cs b/src/DotNet/MethodImplAttributes.cs index b1d3b3a4..eaedf3cc 100644 --- a/src/DotNet/MethodImplAttributes.cs +++ b/src/DotNet/MethodImplAttributes.cs @@ -46,5 +46,7 @@ public enum MethodImplAttributes : ushort { AggressiveOptimization = 0x0200, /// 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. SecurityMitigations = 0x0400, + /// Method requires async state machine rewrite. Available starting with .NET 11.0. + Async = 0x2000, } }