Siegfried Pammer
a537dad7ef
Fix #3774 : keep field initializers when decompiling a static ctor alone
...
The "IL with C#" view decompiles each method body as a bare handle, so a
static constructor is decompiled without its type's field declarations in
the syntax tree. MoveFieldInitializersToDeclarations then could not find a
declaration to move the static-field-initializer statement onto, asserted
(kind was Static, not Primary) and dropped the statement -- crashing Debug
builds and silently losing the assignment in Release.
Dropping the statement is only correct for the primary-constructor case,
where the assignment's backing member is synthesized and has no separate
declaration. For static/instance initializers a missing declaration just
means the member is not part of this partial syntax tree, so the
assignment must remain in the constructor body.
Assisted-by: Claude:claude-opus-4-8:Claude Code
3 weeks ago
Siegfried Pammer
79b0cbb719
Fix #3703 : Do not transform to a primary constructor if it's not public (or protected in abstract classes)
3 months ago
Siegfried Pammer
3a27cbef06
Fix #3617 : Order of XML comments in types with primary constructors
7 months ago
Siegfried Pammer
94050a4aca
Rewrite TransformFieldAndConstructorInitializers from a step-by-step AST-based analysis to an analysis that tracks the whole constructor body.
8 months ago
Siegfried Pammer
7a5a2a00a9
#3452 : Transform field initializers in structs only if no record and no primary ctor.
8 months ago
Siegfried Pammer
cb48768b6d
Fix #3610 : Add more primary constructor test cases.
8 months ago
Siegfried Pammer
46c99f1a21
Fix #3452 : More bugs with primary constructors.
8 months ago
Siegfried Pammer
9c8d1e48d9
Many thanks to @sonyps5201314 for providing the test cases and a suggested fix, which inspired these changes.
...
Various improvements regarding primary constructor decompilation, including:
- introduce `HasPrimaryConstructor` property in the AST, as there is a difference between no primary constructor and a parameterless primary constructor
- improved support for inherited records and forwarded ctor calls
- exclude non-public fields and properties in IsPrintedMember
- introduce an option to always make the decompiler emit primary constructors, when possible
8 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
10 months ago
Jan Kučera
9d11f523b1
Always move initializer decompilation setting
11 months ago
Siegfried Pammer
ddb7171a2a
Fix #3524 : Property without backing field cannot have an initializer.
11 months ago
Siegfried Pammer
453fc06e02
Fix #3406 : Wrong decompilation of record struct without primary constructor.
1 year ago
Siegfried Pammer
e96605ca87
Fix #3310 : Filter out copy-constructor only if it's an actual record type.
2 years ago
Siegfried Pammer
2043e5dd6f
Add support for C# 12 primary constructors.
2 years 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.
4 years ago
Daniel Grunwald
0fbbb6d95e
Fix #2777 : StackOverflowException with recursive delegates
4 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
5 years ago
Siegfried Pammer
ea1cea96c4
Fix #2547 : decimal const not removed from static constructor.
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
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.
6 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
6 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.
7 years ago
Siegfried Pammer
b6c7a25edf
Fix #1661 : Ignore casts on this/base ctor calls, if base type cannot be found.
7 years ago
Siegfried Pammer
17f42066a0
Fix #1378 : Missing unsafe modifier for static fields
8 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 .
9 years ago
Siegfried Pammer
af08020802
Fix build.
9 years ago
Siegfried Pammer
73081e8781
Fix #1008 : Empty decompiled code for a constructor
9 years ago
Siegfried Pammer
cf9731b262
Add special cases for fields and constructors back in CSharpLanguage
9 years ago
Siegfried Pammer
4b6e0cc462
Reimplement transform for auto events
9 years ago
Siegfried Pammer
1e560ac1ba
Extend ConvertConstructorCallIntoInitializer to support C# 6 property initializers
9 years ago
Siegfried Pammer
610f0a922f
Remove AST-helper-methods
10 years ago
Siegfried Pammer
840ec04fde
Namespace adjustments for Syntax classes
10 years ago
Christoph Wille
1ce8349dd9
Adjust namespaces
10 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
Daniel Grunwald
08a5e81517
Re-enable IntroduceUsingDeclarations
12 years ago
Daniel Grunwald
2f83334c2e
Use NRefactory.TypeSystem for ILAst.
12 years ago
Siegfried Pammer
bc68339ac4
rename ConvertedExpression to TranslatedExpression and Convert to Translate, etc.
12 years ago