Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new AllowByRefLike generic parameter attribute #557

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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,
}
}
Loading