Browse Source

Fix #3432: Do not include delegate construction use-sites in DetermineCaptureAndDeclarationScopes.

pull/3416/head
Siegfried Pammer 2 months ago
parent
commit
49942382d1
  1. 6
      ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs

6
ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs

@ -658,6 +658,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -658,6 +658,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms
switch (useSite)
{
case CallInstruction call:
if (DelegateConstruction.MatchDelegateConstruction(useSite, out _, out _, out _))
{
// if this is a delegate construction, skip the use-site, because the capture scope
// was already determined when analyzing "this".
break;
}
int firstArgumentIndex = info.Definition.Method.IsStatic ? 0 : 1;
for (int i = call.Arguments.Count - 1; i >= firstArgumentIndex; i--)
{

Loading…
Cancel
Save