sonyps5201314
13f0ec93db
The special rule for `IsPrimaryConstructor` determination is extended: for `record` types, a complete sequence of assignment statements from the constructor parameters to the `BackingFieldOfAutomaticProperty` must exist.
...
Here's an example:
```cs
record WebPair7(string name, string? value, ref readonly object encode)
{
public string? Value { get; } = name;
public string Name { get; } = value;
string? WebValue { get; } = name != null ? "111" : value;
string? WebValue2;
}
```
5 months ago
sonyps5201314
1a0696e851
Add a special case to the `IsPrimaryConstructor` determination logic: for a `record struct` type, there must be at least one assignment from a constructor parameter to a `BackingFieldOfAutomaticProperty`.
5 months ago
sonyps5201314
ae24166cd4
The primary constructor check is also skipped when a constructor ends with `NOP NOP RET` instructions, to allow some unit tests to pass.
5 months ago
sonyps5201314
2a887cc5fd
When a constructor starts with a NOP instruction, the primary constructor check is skipped to allow some unit tests to pass.
5 months ago
sonyps5201314
439ceef2a2
Fixed an issue where the copy constructor of type `DerivedGeneric` in unit tests was not recognized as compiler-generated code after the commit "`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.`".
5 months ago
sonyps5201314
fee9db9f9d
Fixed an issue where two `PrimaryCtorWithField` types in unit tests could not be decompiled correctly
5 months ago
sonyps5201314
27f5275718
Fixed unsupport for types containing multiple regular constructors, none of which chain calls to the primary constructor.
...
Here's an example:
```cs
public record struct CopilotContextId
{
public CopilotContextId() => this.Id = Guid.NewGuid();
public CopilotContextId(Guid id) => this.Id = id;
public Guid Id { get; }
}
```
5 months ago
sonyps5201314
ae86ddf3c8
Fixed the issue that the `Index` type in “ https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Polyfills/Index.cs ” would be decompiled incorrectly after the commit of “Make `ILSpy` support `struct` and `record struct` types declared with a primary constructor and containing other constructors.”.
5 months ago
sonyps5201314
cae466e5b0
Make `ILSpy` support `struct` and `record struct` types declared with a primary constructor and containing other constructors.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
public struct CopilotContextId_Struct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_Struct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
89c7e59176
Fixed an issue where the `record struct` type declared with a primary constructor could not be decompiled correctly. The reason was that `HandleInstanceFieldInitializers` did not support the `struct` type, but `DetectPrimaryConstructor` did not exclude it in advance.
...
Here's an example:
```cs
public record struct CopilotContextId_RecordStruct(Guid id)
{
public Guid guid { get; } = id;
public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
{
}
}
```
5 months ago
sonyps5201314
9a4e49a7d4
Fixed an issue where the "CopilotQueriedScopeMention" type in "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\Microsoft.VisualStudio.Copilot.Contracts\Microsoft.VisualStudio.Copilot.dll" could not be decompiled correctly after expanding the judgment logic of IsPrimaryConstructor.
5 months ago
sonyps5201314
828fb52390
`IsBaseCtorCall` no longer checks the number of parameters. Otherwise, it would cause the translation of the `DeserializationException` type in ` https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Serializers/DeseralizationException.cs ` to fail, as it is a primary constructor declaration that calls a base constructor with two arguments.
...
Additionally, dotPeek's `IsPrimaryConstructorFast` function has been introduced. This is because, after the aforementioned modification to `IsBaseCtorCall`, the `NamedParameter` type in RestSharp was being incorrectly identified as a primary constructor. Without this correction, it would lead to many compilation errors.
6 months ago
sonyps5201314
8d1cfee963
The internal judgment logic of IsPrimaryConstructor should exclude the copy constructor first, otherwise it will be judged incorrectly whether the NamedParameter type in https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Parameters/Parameter.cs uses the primary constructor.
6 months ago
sonyps5201314
10ce064833
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.
6 months ago
sonyps5201314
aae1a28895
The IsPrimaryConstructor function is reimplemented based on some of dotPeek's judgment rules and the definition and characteristics of the primary constructor. However, it is found that dotPeek's judgment logic is also problematic. For example, it does not support the following scenario: ``` class WebPair(string name, string? value, ref readonly object encode) { public string Name { get; } = name; public string? Value { get; } = value; string? WebValue { get; } = encode is null ? "111" : value; string? WebValue2 { get; } = encode.ToString(); } ```
6 months ago
sonyps5201314
e8f32ec592
Fixed the issue where IsPrimaryConstructor's judgment was too conservative, which resulted in the inability to generate correct code in many scenarios.
6 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
7 months ago
Siegfried Pammer
453fc06e02
Fix #3406 : Wrong decompilation of record struct without primary constructor.
1 year ago
Siegfried Pammer
2043e5dd6f
Add support for C# 12 primary constructors.
2 years ago
Siegfried Pammer
4bf9487ecd
Remove IsRef, IsOut and IsIn flags from IParameter and Replace ParameterModifiers with ReferenceKind.
2 years ago
Siegfried Pammer
ca78d4a14d
Use MetadataFile instead of PEFile in TypeSystem.
2 years ago
Andrew Crawley (US - DIAGNOSTICS)
7451b21650
Fix decompilation of record with missing base type
...
This commit updates `RecordDecompiler` to avoid a null ref when the
decompiler is unable to determine the base type of a record (e.g.
because the base type is defined in another assembly that is not
loaded).
3 years ago
Siegfried Pammer
ae0e83f0c4
Records: Support new EqualityContract pattern.
3 years ago
Siegfried Pammer
1f1e95d7a1
Update RecordDecompiler for Roslyn 4.3.0.
4 years ago
Daniel Grunwald
08ceffc3ad
Upgrade dotnet-format from version 5 to the version included with the .NET (6) SDK.
4 years ago
Siegfried Pammer
d248867302
Add support for C# 10 record structs.
4 years ago
SilverFox
1367e7ba95
Add support for `in parameters` in primary ctor of records
5 years ago
SilverFox
11b44e53b7
Add support for attributes of field/property in primary ctor of records
5 years ago
SilverFox
58bed656cd
Fix records support for Roslyn 4.0.0-3.final
5 years ago
SilverFox
89eebc387a
Fix #2475 : Fix support for records with custom copy ctor
5 years ago
SilverFox
d0d70a6496
Fix #2475 : Add support for sealed records and records with interface
5 years ago
Daniel Grunwald
55ab2a1739
Adjust RecordDecompiler to changes in Roslyn 3.10.0
5 years ago
Daniel Grunwald
bd9aabeae2
Update to dotnet-format 5.1.225507.
...
This makes the formatting expected by our CI consistent with that generated by VS2019.9.
5 years ago
Siegfried Pammer
032bd5356a
Fix formatting
5 years ago
Siegfried Pammer
a5858f1694
Add support for primary constructor syntax.
5 years ago
Daniel Grunwald
be9871981a
Records: Detect compiler-generated Equals() in derived records.
5 years ago
Daniel Grunwald
d9874380cd
Records: support generic records
5 years ago
Daniel Grunwald
0bf6d552e0
Records: support for fields.
5 years ago
Daniel Grunwald
a960216d5f
Add test case for simple records.
5 years ago
Daniel Grunwald
e02c4789f1
Records: detect copy constructor
5 years ago
Daniel Grunwald
c95f75d3bc
Records: detect whether GetHashCode is compiler-generated
5 years ago
Daniel Grunwald
648e7f9f87
Records: hide generated Equals() method
5 years ago
Daniel Grunwald
4fefd5f530
Records: detect when PrintMembers() is compiler-generated in derived records
5 years ago
Daniel Grunwald
500317a9e8
Records: detect when PrintMembers() is compiler-generated
...
Only for the simple case: record having only (auto-)properties but no fields and no inheritance.
5 years ago
Daniel Grunwald
0babcc5fe4
Records: detect when ToString() is compiler-generated
5 years ago
Daniel Grunwald
90ce77f400
Omit EqualityContract if it's automatically generated.
5 years ago