Skip to content

Commit

Permalink
Add new AllowByRefLike generic parameter attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ElektroKill committed May 28, 2024
1 parent 0b2dc95 commit b265766
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DotNet/GenericParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ public bool HasDefaultConstructorConstraint {
set => ModifyAttributes(value, GenericParamAttributes.DefaultConstructorConstraint);
}

/// <summary>
/// Gets/sets the <see cref="GenericParamAttributes.AllowByRefLike"/> bit
/// </summary>
public bool AllowsByRefLike {
get => ((GenericParamAttributes)attributes & GenericParamAttributes.AllowByRefLike) != 0;
set => ModifyAttributes(value, GenericParamAttributes.AllowByRefLike);
}

/// <inheritdoc/>
void IListListener<GenericParamConstraint>.OnLazyAdd(int index, ref GenericParamConstraint value) => OnLazyAdd2(index, ref value);

Expand Down
2 changes: 2 additions & 0 deletions src/DotNet/GenericParamAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ public enum GenericParamAttributes : ushort {
NotNullableValueTypeConstraint = 0x0008,
/// <summary>type argument must have a public default constructor</summary>
DefaultConstructorConstraint = 0x0010,
/// <summary>type argument can be ByRefLike</summary>
AllowByRefLike = 0x0020,
}
}

0 comments on commit b265766

Please sign in to comment.