Siegfried Pammer
247cc1f3ed
Declare VB anonymous types that C# anonymous types cannot express
...
A C# anonymous type is immutable and compares every member. VB's are neither
unless every property is declared 'Key': otherwise the properties are settable
and only the 'Key' ones take part in Equals and GetHashCode. Writing such a
type as 'new { ... }' silently gave it value equality and made any assignment
to one of its properties fail to compile, so only an anonymous type with no
settable property is treated as one; the rest keep their own declaration.
Those declarations carry the shape VB gave them, so the round-trip preserves
both mutability and 'Key' equality. Their names are the remaining obstacle,
since the VB compiler separates the parts with '$': the type, its backing
fields and any local named after it are renamed to use '_' instead, and a
comment on the declaration says why the type is spelled out.
Generated variable names are now rejected when they would not be legal C#
identifiers, which also stops a display class from lending its unspeakable
name to a local in the NoLocalFunctions output.
Assisted-by: Claude:claude-fable-5:Claude Code
1 month ago
Siegfried Pammer
c0a9afc4ad
Fix #3616 : local variable naming conflict with primary constructor parameters.
9 months ago
ds5678
df9cc3dfbe
Null forgiveness for UsingScope
12 months ago
ds5678
c54318173b
Fix lower case type name conflicting with variable name
12 months ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
1 year ago
Siegfried Pammer
f97e59760b
Fix #3512 : Local function name collides with local variable name
1 year ago
Siegfried Pammer
b1a617c827
AssignVariableNames: Fix ArgumentException
1 year ago
Siegfried Pammer
7d0262d779
Fix #3439 : Regressed decompilation of variables in lambda scope
1 year ago
Siegfried Pammer
349a89c1fa
Fix #3436 : Duplicate naming of local functions
1 year ago
Siegfried Pammer
355a039b59
Sightly improve variable naming of known types such as EventArgs and Exceptions
2 years ago
Siegfried Pammer
8a67f48e4e
Fix #1956 : Adapt previous fix for variable names that have a number as suffix.
2 years ago
Siegfried Pammer
ffcd468d22
Fix #1572 : parameters of lambdas and local functions are renamed, if there are with names from outer scopes collisions.
2 years ago
Siegfried Pammer
03aecf047d
Add VariableScope and rework AssignVariableNames step to support renaming parameters of nested ILFunctions in the future.
2 years ago
Siegfried Pammer
a599aae54d
#1572 : Do not generate variable names that match C# keywords.
2 years ago
Siegfried Pammer
966b99a7f9
Fix #3278 : Missing variable declaration in nested for-loop after many other loops
2 years ago
Siegfried Pammer
58e993d71d
Fix #3272 : Missing variable declarations in repeated nested for-loops
2 years ago
Siegfried Pammer
2ca5b5affe
Rewrite AssignVariableNames algorithm to use variable usages instead of the list of variables.
2 years ago
Siegfried Pammer
c67d086e2f
Add test cases for naming conflicts related to foreach, using and fixed variables. Remove unnecessary ConflictWithLocal check in AssignVariableNames.
2 years ago
Siegfried Pammer
3fb153940b
AssignVariableNames: Handle fixed statement special cases
2 years ago
Siegfried Pammer
566af5c2fb
Fix #3113 : Remove GetAlternativeName and instead reuse existing names, if there are no conflicts.
3 years ago
Siegfried Pammer
0fc003459f
Fix #3079 : Replace parameter names that consist of only whitespace
3 years ago
Siegfried Pammer
51a8eb28f1
Add support for var sub patterns.
3 years ago
Siegfried Pammer
539925f259
Fix #2983 : display-class locals should be named uniquely per top-level ILFunction. Add assertion to ResolveCollisions: ensure that colliding/merged variables have the same type.
3 years ago
Siegfried Pammer
619d2af9b2
Add GetNamespaceByFullName and use it to speed up AssignVariableNames.CollectAllLowerCaseTypeNames
4 years ago
Daniel Grunwald
b4b070468f
Revert "Performance Optimization: Do no longer collect all lower case type and member names."
...
This reverts commit 6584a2f576 .
4 years ago
Siegfried Pammer
6584a2f576
Performance Optimization: Do no longer collect all lower case type and member names.
4 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
d60f158dfd
Fix #2342 : Do not generate empty names for foreach loop variables.
6 years ago
Siegfried Pammer
669fe6417e
Fix #2280 : Add additional checks to GenerateVariableName
6 years ago
Siegfried Pammer
288c6a75e7
Use ToLower instead of ToLowerInvariant.
6 years ago
Siegfried Pammer
dd84f17ea1
#2263 : Fix IsLowerCase to take script without upper/lower case distinction into account.
6 years ago
Siegfried Pammer
06bae54b91
Fix #2263 : Add lower-case type and member names to the list of existing names, to prevent collisions.
6 years ago
Siegfried Pammer
c986dbe889
Fixes #2232 : We only need a small percentage of features provided by Humanizer. Therefore we copy the relevant parts and remove the dependency in order to avoid such problems in the future.
6 years ago
Siegfried Pammer
d0d8299ef5
Use Name from DynamicInvokeMemberInstruction when inferring variable names.
6 years ago
Siegfried Pammer
be57dc454c
Run tests with different versions of Roslyn
6 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
6 years ago
Siegfried Pammer
acea95d0a1
Properly rename LocalFunctionMethod.Name on all instructions
6 years ago
Daniel Grunwald
1b2874eb5d
Use `nint` type for local IntPtr variables if arithmetic is performed on them.
6 years ago
Siegfried Pammer
371d732c0a
Fix #1881 : Not properly reusing names from PDB#2
7 years ago
Siegfried Pammer
92e1d6fe85
Fix #1907 : Discard parameter names containing non-printable or white space characters from set of possible names considered by AssignVariableNames.
7 years ago
Siegfried Pammer
a653b8b566
Fix #1841 : Not properly reusing names from PDB
7 years ago
Siegfried Pammer
c3e61b39fc
#1681 : Include fields from base types in AssignVariableNames.CollectReservedVariableNames
7 years ago
Siegfried Pammer
305b47245e
Refactor representation of local functions in ILAst.
7 years ago
Siegfried Pammer
8d1522f387
Transform display classes used in local functions.
7 years ago
Daniel Grunwald
a5505ab00d
Expose IMethod.AccessorKind. This makes it easier to determine if a method is a setter, particular in generic classes where "m.AccessorOwner?.Setter == m" ended up being wrong.
8 years ago
Siegfried Pammer
b0309ca9e3
Fix #1180 : Fix generation of Windows Forms InitializeComponent.
8 years ago
Daniel Grunwald
763683748b
Emit debug info for display class locals, so that the debugger can show the values of captured variables.
8 years ago
Daniel Grunwald
e041454987
Add pretty tests for "yield return" and fix some minor bugs:
...
* remove redundant casts on yield-return-expression
* keep variable name from metadata for foreach loops
* fix 'yield break;' in nested try-finally sometimes causing a decompiler error
8 years ago
Daniel Grunwald
12e74daf48
Handle Comp in InferType().
8 years ago
Daniel Grunwald
9479e8af13
Support overloaded operator &&/||.
8 years ago