sonyps5201314
793d4171f2
Support for `struct` types written in non-primary constructor form that contain field initialization statements has been added. This type was previously mentioned in the commit with the message "The logic was temporarily adjusted so that the `StructWithDefaultCtor` type in the unit test could pass the test. In fact, the member initialization statement in its constructor could be moved."
...
Here's an example:
```cs
public struct StructWithDefaultCtor2
{
public int X = 42;
public int Y = Math.Max(1, 2);
public event EventHandler MyEvent = delegate { };
public int Z { get; set; } = Math.Max(3, 5);
public StructWithDefaultCtor2()
{
}
}
public struct StructWithDefaultCtor3
{
public int X = 42;
public int Y = Math.Max(1, 2);
public event EventHandler MyEvent;
public int Z { get; set; }
public StructWithDefaultCtor3()
{
MyEvent = delegate { };
Z = Math.Max(3, 5);
}
}
```
2 months ago
sonyps5201314
dc452836e0
Fix failing unit tests: `InitializerTests` and `ValueTypes`.
2 months ago
sonyps5201314
5672c58bcf
Fixed an issue where the `TestRef` type in the example below could not be decompiled correctly after the commit: `Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.`
...
```cs
public ref struct TestRef(ref int a)
{
public ref int AAA = ref a;
public void Print()
{
int val = AAA;
Console.WriteLine(val);
}
}
```
2 months ago
sonyps5201314
8abe38128e
Fixed an issue where [RestClientOptions]( https://github.com/restsharp/RestSharp/blob/dev/src/RestSharp/Options/RestClientOptions.cs ) could not be decompiled correctly after the commit: `Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.`
2 months ago
sonyps5201314
16c2b8c1a9
The logic was temporarily adjusted so that the `StructWithDefaultCtor` type in the unit test could pass the test. In fact, the member initialization statement in its constructor could be moved.
...
Here's an example:
when `IsPrimaryConstructor` return `false`:
```cs
struct StructWithDefaultCtor
{
int X = 42;
public StructWithDefaultCtor()
{
}
}
```
when `IsPrimaryConstructor` return `true`:
```cs
struct StructWithDefaultCtor()
{
int X = 42;
}
```
2 months ago
sonyps5201314
851a1f3af5
Fixed an issue where the logic of moving the initialization statement of class members in the constructor to the class member declaration was incompatible with complex expressions using parameters.
...
Here's an example:
```cs
public struct FromBinaryOperator
{
public int Leet;
public FromBinaryOperator(int dummy1, int dummy2)
{
Leet = dummy1 + dummy2;
}
}
public struct FromCall
{
public int Leet;
public FromCall(int dummy1, int dummy2)
{
Leet = Math.Max(dummy1, dummy2);
}
}
public struct FromConvert
{
public int Leet;
public FromConvert(double dummy1, double dummy2)
{
Leet = (int)Math.Min(dummy1, dummy2);
}
}
```
2 months ago
sonyps5201314
461ffe57fe
Fixed an issue in unit tests where the `RefFields` type would be decompiled into incorrect code when the return value of the `IsPrimaryConstructor` function was forcibly changed to `false`.
2 months ago
sonyps5201314
c5fc18c94e
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.
2 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())
{
}
}
```
2 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.
2 months ago
sonyps5201314
554ec92e73
Fix the issue where parameters in the base class constructor call are not passed correctly for inherited classes declared using the primary constructor form (e.g., the `DeserializationException` type in RestSharp), and also fix the subsequent issue where an extra parenthesis '()' is output if the base class is an interface (e.g., the `XmlRestSerializer` type in RestSharp).
2 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
4 months ago
Jan Kučera
9d11f523b1
Always move initializer decompilation setting
5 months ago
Siegfried Pammer
ddb7171a2a
Fix #3524 : Property without backing field cannot have an initializer.
5 months ago
Siegfried Pammer
453fc06e02
Fix #3406 : Wrong decompilation of record struct without primary constructor.
9 months ago
Siegfried Pammer
e96605ca87
Fix #3310 : Filter out copy-constructor only if it's an actual record type.
1 year ago
Siegfried Pammer
2043e5dd6f
Add support for C# 12 primary constructors.
1 year ago
Siegfried Pammer
ca78d4a14d
Use MetadataFile instead of PEFile in TypeSystem.
2 years ago
Siegfried Pammer
9017592d1d
Fix #2764 : Move constant field initializers regardless of whether the other field initializers can be moved.
3 years ago
Daniel Grunwald
0fbbb6d95e
Fix #2777 : StackOverflowException with recursive delegates
3 years ago
Siegfried Pammer
11468135b4
Add special-case for non-primary record struct constructors
4 years ago
Siegfried Pammer
d248867302
Add support for C# 10 record structs.
4 years ago
Siegfried Pammer
210601fcfa
Fix #2495 : VB.NET decimal constants are not supported
4 years ago
Siegfried Pammer
ea1cea96c4
Fix #2547 : decimal const not removed from static constructor.
4 years ago
SilverFox
89eebc387a
Fix #2475 : Fix support for records with custom copy ctor
4 years ago
SilverFox
d0d70a6496
Fix #2475 : Add support for sealed records and records with interface
4 years ago
Siegfried Pammer
ec1b9a4ccd
Fix #2443 : do not use this()-ctor initializers by accident if base type is unknown.
5 years ago
Siegfried Pammer
a5858f1694
Add support for primary constructor syntax.
5 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
5 years ago
Siegfried Pammer
6382f8c41d
Fix #1990 : Empty default ctor with XML comment discarded from decompilation
6 years ago
Siegfried Pammer
b1352aa569
Fix #1743 : Add pattern for struct constructor initializers.
6 years ago
Siegfried Pammer
b6c7a25edf
Fix #1661 : Ignore casts on this/base ctor calls, if base type cannot be found.
6 years ago
Siegfried Pammer
17f42066a0
Fix #1378 : Missing unsafe modifier for static fields
7 years ago
Siegfried Pammer
71ffb0183b
Fix #1103 : Deactivating "Insert using declarations" now uses fully qualified types everywhere.
8 years ago
Daniel Grunwald
1f3916d554
Use the resolve methods in MetadataModule, and remove the wrappers in DecompilerTypeSystem.
8 years ago
Siegfried Pammer
458f448fae
Avoid unnecessary allocations of MetadataReader and clean up Dom structs a bit.
8 years ago
Siegfried Pammer
a70f19d536
Partially port transforms
8 years ago
Siegfried Pammer
5dd7eaf129
Fix #1093 : Remove usage of type or this qualifiers, when possible.
8 years ago
Siegfried Pammer
4cccf9fac5
Fix crash described in #1038 .
8 years ago
Siegfried Pammer
af08020802
Fix build.
8 years ago
Siegfried Pammer
73081e8781
Fix #1008 : Empty decompiled code for a constructor
8 years ago
Siegfried Pammer
cf9731b262
Add special cases for fields and constructors back in CSharpLanguage
8 years ago
Siegfried Pammer
4b6e0cc462
Reimplement transform for auto events
8 years ago
Siegfried Pammer
1e560ac1ba
Extend ConvertConstructorCallIntoInitializer to support C# 6 property initializers
8 years ago
Siegfried Pammer
610f0a922f
Remove AST-helper-methods
9 years ago
Siegfried Pammer
840ec04fde
Namespace adjustments for Syntax classes
9 years ago
Christoph Wille
1ce8349dd9
Adjust namespaces
9 years ago
Siegfried Pammer
238179248d
Fix bug in ConvertConstructorCallIntoInitializer: only non-chained ctors should be checked for initializer equality.
10 years ago
Siegfried Pammer
c8f38af6d5
fix generics issue with cctor conversion
10 years ago
Siegfried Pammer
a8a78da710
Fix generics issue in ConvertConstructorCallIntoInitializerVisitor: use non-specialized fields for comparison
10 years ago