Skip to content

Commit 266b148

Browse files
authored
Merge pull request #623 from ds5678/generic-parameter-allow-by-ref-like
AllowByRefLike support
2 parents 697a1ae + 851a588 commit 266b148

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/AsmResolver.DotNet/GenericParameter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ public bool HasDefaultConstructorConstraint
155155
| (value ? GenericParameterAttributes.DefaultConstructorConstraint : default);
156156
}
157157

158+
/// <summary>
159+
/// Gets or sets a value indicating whether this generic parameter has <see cref="GenericParameterAttributes.AllowByRefLike"/> enabled.
160+
/// </summary>
161+
public bool HasAllowByRefLike
162+
{
163+
get => (Attributes & GenericParameterAttributes.AllowByRefLike) != 0;
164+
set => Attributes = (Attributes & ~GenericParameterAttributes.AllowByRefLike)
165+
| (value ? GenericParameterAttributes.AllowByRefLike : default);
166+
}
167+
158168
/// <summary>
159169
/// Gets the index of this parameter within the list of generic parameters that the owner defines.
160170
/// </summary>

src/AsmResolver.PE/DotNet/Metadata/Tables/GenericParameterAttributes.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,9 @@ public enum GenericParameterAttributes : ushort
4040
/// Specifies the generic parameter's type argument must have a public default constructor.
4141
/// </summary>
4242
DefaultConstructorConstraint = 0x0010,
43+
/// <summary>
44+
/// Specifies the generic parameter can be a ref struct type.
45+
/// </summary>
46+
AllowByRefLike = 0x0020,
4347
}
4448
}

0 commit comments

Comments
 (0)