Browse Source

Fixed an issue where the `Range` type in "https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Polyfills/Range.cs" could not be decompiled correctly after adjusting the judgment logic of the primary constructor.

pull/3598/head
sonyps5201314 2 months ago
parent
commit
c5fc18c94e
  1. 5
      ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs

5
ICSharpCode.Decompiler/CSharp/Transforms/TransformFieldAndConstructorInitializers.cs

@ -233,6 +233,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -233,6 +233,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
if (v?.Kind == IL.VariableKind.Parameter)
{
isStructPrimaryCtor = record?.PrimaryConstructor != null;
if (!isStructPrimaryCtor)
{
// When there is no primary constructor, assignments from constructor parameters to fields or properties cannot be transferred.
break;
}
if (fieldOrPropertyOrEvent is IField f)
fieldToVariableMap.Add(f, v);
}

Loading…
Cancel
Save