From 1da214577984a511fb7de3ada0f39ae4d755db99 Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Tue, 21 May 2024 08:19:01 -0700 Subject: [PATCH] Add new flag for ByRefLike constraints (#945) * Add new flag for ByRefLike constraints * Allow seems to be the prefered nomenclature --- Mono.Cecil/GenericParameter.cs | 5 +++++ Mono.Cecil/GenericParameterAttributes.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Mono.Cecil/GenericParameter.cs b/Mono.Cecil/GenericParameter.cs index 30dd73382..de746449b 100644 --- a/Mono.Cecil/GenericParameter.cs +++ b/Mono.Cecil/GenericParameter.cs @@ -165,6 +165,11 @@ public bool HasDefaultConstructorConstraint { set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.DefaultConstructorConstraint, value); } } + public bool AllowByRefLikeConstraint { + get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.AllowByRefLikeConstraint); } + set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.AllowByRefLikeConstraint, value); } + } + #endregion public GenericParameter (IGenericParameterProvider owner) diff --git a/Mono.Cecil/GenericParameterAttributes.cs b/Mono.Cecil/GenericParameterAttributes.cs index 149582cdb..51f094f47 100644 --- a/Mono.Cecil/GenericParameterAttributes.cs +++ b/Mono.Cecil/GenericParameterAttributes.cs @@ -22,6 +22,7 @@ public enum GenericParameterAttributes : ushort { SpecialConstraintMask = 0x001c, ReferenceTypeConstraint = 0x0004, NotNullableValueTypeConstraint = 0x0008, - DefaultConstructorConstraint = 0x0010 + DefaultConstructorConstraint = 0x0010, + AllowByRefLikeConstraint = 0x0020, } }