From 385578f978ce405875956f91bc4a5f361ddb8e53 Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Mon, 20 May 2024 20:15:41 -0700 Subject: [PATCH 1/2] Add new flag for ByRefLike constraints --- 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..f3249f86e 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 HasAcceptByRefLikeConstraint { + get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.AcceptByRefLikeConstraint); } + set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.AcceptByRefLikeConstraint, value); } + } + #endregion public GenericParameter (IGenericParameterProvider owner) diff --git a/Mono.Cecil/GenericParameterAttributes.cs b/Mono.Cecil/GenericParameterAttributes.cs index 149582cdb..4d062b030 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, + AcceptByRefLikeConstraint = 0x0020, } } From cd67c873610c861b5cb6066e60ac9903d1515836 Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Mon, 20 May 2024 20:39:49 -0700 Subject: [PATCH 2/2] Allow seems to be the prefered nomenclature --- Mono.Cecil/GenericParameter.cs | 6 +++--- Mono.Cecil/GenericParameterAttributes.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Mono.Cecil/GenericParameter.cs b/Mono.Cecil/GenericParameter.cs index f3249f86e..de746449b 100644 --- a/Mono.Cecil/GenericParameter.cs +++ b/Mono.Cecil/GenericParameter.cs @@ -165,9 +165,9 @@ public bool HasDefaultConstructorConstraint { set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.DefaultConstructorConstraint, value); } } - public bool HasAcceptByRefLikeConstraint { - get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.AcceptByRefLikeConstraint); } - set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.AcceptByRefLikeConstraint, value); } + public bool AllowByRefLikeConstraint { + get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.AllowByRefLikeConstraint); } + set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.AllowByRefLikeConstraint, value); } } #endregion diff --git a/Mono.Cecil/GenericParameterAttributes.cs b/Mono.Cecil/GenericParameterAttributes.cs index 4d062b030..51f094f47 100644 --- a/Mono.Cecil/GenericParameterAttributes.cs +++ b/Mono.Cecil/GenericParameterAttributes.cs @@ -23,6 +23,6 @@ public enum GenericParameterAttributes : ushort { ReferenceTypeConstraint = 0x0004, NotNullableValueTypeConstraint = 0x0008, DefaultConstructorConstraint = 0x0010, - AcceptByRefLikeConstraint = 0x0020, + AllowByRefLikeConstraint = 0x0020, } }