Siegfried Pammer
60c08fcb74
Keep 'delegate {}' when a parameter type is inaccessible
...
The parameter-list-less anonymous method form is compatible with any
delegate signature, and C# code must rely on exactly that when a
delegate's parameter types cannot be named at the use site: IL, unlike
C#, permits a delegate signature to reference less accessible types.
Expanding such an anonymous method into a lambda would force the
unnameable type into a parameter list. Keep the delegate form, with its
parameter list dropped, when the parameters are unused and one of their
types is not accessible from the current context.
Assisted-by: Claude:claude-fable-5:Claude Code
1 month ago
Siegfried Pammer
3cc49044ec
Extend UseLambdaSyntax to emit statement lambdas
...
Under UseLambdaSyntax, anonymous functions became lambdas only when an
expression body was possible; statement-bodied ones kept C# 2 delegate
syntax. Now every anonymous function whose parameter shape a lambda can
express uses lambda syntax; delegate syntax remains for ref/out/in and
params parameters and for pre-C# 3 language profiles.
Two latent issues surfaced by the wider lambda coverage: DeclareVariables
assumed an insertion point directly under a LambdaExpression is an
expression body it must convert to a block, which block-bodied lambdas
now violate; and anonymous methods declared without a parameter list
carry compiler-generated parameter names like '<p0>' that are not valid
identifiers, so the lambda's mandatory parameter list regenerates such
names from the parameter type: (object obj, EventArgs e) => ...
A side effect visible in fixtures: an explicit parameter list can make
a delegate-creation cast redundant that bare 'delegate' syntax needed
for overload resolution, e.g. new Thread((ThreadStart)delegate { })
becomes new Thread(() => { }).
Assisted-by: Claude:claude-fable-5:Claude Code
1 month ago
Peter Crabtree
e1e16b64f5
dev: Strip BOM mark from text files
1 year ago
Siegfried Pammer
8834c02eb7
Improve naming of delegate-typed variables.
1 year ago
Siegfried Pammer
485ca1d69a
Fix #3353 : Normal method is decompiled as lambda expression.
1 year ago
Siegfried Pammer
349a89c1fa
Fix #3436 : Duplicate naming of local functions
1 year 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
2ca5b5affe
Rewrite AssignVariableNames algorithm to use variable usages instead of the list of variables.
2 years ago
Siegfried Pammer
47250d670b
Fix #2791 : Ensure that the capture scope used is either a loop or the ILFunction root container.
4 years ago
Daniel Grunwald
0fbbb6d95e
Fix #2777 : StackOverflowException with recursive delegates
4 years ago
Daniel Grunwald
21c3ec046f
Output attributes on lambda expressions
4 years ago
Siegfried Pammer
6a27959cbc
Improve decompilation of delegate references of extension methods.
4 years ago
Siegfried Pammer
0bc11d05d3
Fix #2634 : target expressions of delegate references were not decompiled correctly
4 years ago
Siegfried Pammer
be57dc454c
Run tests with different versions of Roslyn
6 years ago
Daniel Grunwald
03787bfc70
Avoid parentheses around lambdas where possible.
6 years ago
Siegfried Pammer
8e9ecf6c36
Fix #2162 : handle VariableInitializers like AssignmentExpressions in InsertParenthesesVisitor
6 years ago
Siegfried Pammer
549f7fb44d
Fix #2143 : Missing `this.` qualification in lambda
6 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
6 years ago
Siegfried Pammer
2403548ce3
Add tests for C# 9.0 lambda parameter discards
6 years ago
Siegfried Pammer
f831e4713f
Fix #1867 : Captures of copies of this are not properly handled by the decompiler
7 years ago
SilverFox
14cd09d7bc
Update some tests, and add some limited descributed in PR to tests(disabled)
7 years ago
Siegfried Pammer
6709827ba5
Fix build.
7 years ago
Siegfried Pammer
ddba47a82b
#1773 : Add more test cases
7 years ago
Siegfried Pammer
9bb2ea872c
Fix #1773 : Remove copies of parameter values only if the types match exactly.
7 years ago
Siegfried Pammer
413c9eba2c
#1759 : Follow-up: Handle nested generic arguments as well.
7 years ago
Siegfried Pammer
6330be36b3
Fix #1759 : Substitute display-class type parameters with method type parameters in TransformDisplayClassUsage.
7 years ago
Siegfried Pammer
ec18094c65
Implement transformation of delegate construction with ldvirtftn.
7 years ago
Siegfried Pammer
3d60c7bd70
Fix #1590 : Cast from override method to Delegate is not properly simplified
7 years ago
Siegfried Pammer
89a50e64fc
Extension method syntax on lambda expressions/delegates is not allowed.
7 years ago
Siegfried Pammer
63646b0ace
Fix #1472 : Apply ExpressionTransforms after CombineExitsTransform to "canonicalize logic and/or"
8 years ago
Siegfried Pammer
5dd7eaf129
Fix #1093 : Remove usage of type or this qualifiers, when possible.
9 years ago
Siegfried Pammer
bacb293db8
Fix #971 : Anonymous method with missing parameter name
9 years ago
Siegfried Pammer
f8afa6051d
Fix another instance of #951 : Incorrect decompilation of anonymous delegate
9 years ago
Siegfried Pammer
8135157e95
Fix #951 : Incorrect decompilation of anonymous delegate
9 years ago
Siegfried Pammer
2ca7ea87f1
Fix #955 : Ambiguous decompilation of anonymous delegates
9 years ago
Daniel Grunwald
b7a5924b25
When possible, use implicit method group conversions to construct delegates.
9 years ago
Daniel Grunwald
71f85d8e1d
Move DelegateConstruction test into namespace.
9 years ago
Daniel Grunwald
236c7c28b4
Remove redundant lambda casts.
9 years ago
Siegfried Pammer
911cdbca66
Add DelegateConstruction tests
9 years ago
Siegfried Pammer
e26af08a1c
Move test projects to their own directory in \
9 years ago
Daniel Grunwald
d2c24a3b0a
Don't eliminate delegate caching when lambda decompilation is disabled.
...
Closes #388
14 years ago
Daniel Grunwald
e0c7bebfe8
Add license headers to the files that were missing them.
16 years ago
Daniel Grunwald
57db57670c
Fix bug when decompiling lambdas that are nested 3 or more levels (and have a closure on each level).
16 years ago
Daniel Grunwald
d805e07ffe
Fixed decompilation of nested lambdas.
16 years ago
Daniel Grunwald
542bb9db2f
Improved handling of nested display classes.
16 years ago
Daniel Grunwald
69ac94363d
Resolve variable naming conflicts that occur with anonymous methods.
16 years ago
Daniel Grunwald
b5e29f0e05
Adjust unit tests.
16 years ago
Artur Zgodziñski
16fd9d07e3
Indexers support. Explicit implementation of methods and parameters.
...
Conflicts:
ICSharpCode.Decompiler/Tests/ICSharpCode.Decompiler.Tests.csproj
ICSharpCode.Decompiler/Tests/Types/TypeTests.cs
16 years ago
Daniel Grunwald
60c02d577b
Change namespace to ICSharpCode.Decompiler.
16 years ago