Browse Source

Fixed the issue where the DefaultParameters type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/DefaultParameters.cs was incorrectly judged as to whether the primary constructor was used due to incorrect initialization logic of isStruct and isInheritedRecord in the constructor of the RecordDecompiler class.

pull/3598/head
sonyps5201314 2 months ago
parent
commit
10ce064833
  1. 5
      ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

5
ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

@ -53,8 +53,9 @@ namespace ICSharpCode.Decompiler.CSharp @@ -53,8 +53,9 @@ namespace ICSharpCode.Decompiler.CSharp
this.settings = settings;
this.cancellationToken = cancellationToken;
this.baseClass = recordTypeDef.DirectBaseTypes.FirstOrDefault(b => b.Kind == TypeKind.Class);
this.isStruct = baseClass?.IsKnownType(KnownTypeCode.ValueType) ?? false;
this.isInheritedRecord = !isStruct && !(baseClass?.IsKnownType(KnownTypeCode.Object) ?? false);
this.isStruct = recordTypeDef.Kind == TypeKind.Struct;
var baseClassTypeDef = baseClass as ITypeDefinition;
this.isInheritedRecord = !isStruct && (baseClassTypeDef?.IsRecord ?? false);
this.isSealed = recordTypeDef.IsSealed;
DetectAutomaticProperties();
this.orderedMembers = DetectMemberOrder(recordTypeDef, backingFieldToAutoProperty);

Loading…
Cancel
Save