Skip to content

Commit 31b4e6a

Browse files
Fix #2185: Fix MemberIsHidden-check for local function display structs: Async State Machines that looked like local function display structs were not hidden once local function decompilation was disabled. This led to code duplication in the generated pdb.
1 parent 46e1e3e commit 31b4e6a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ public static bool MemberIsHidden(Metadata.PEFile module, EntityHandle member, D
286286
var methodSemantics = module.MethodSemanticsLookup.GetSemantics(methodHandle).Item2;
287287
if (methodSemantics != 0 && methodSemantics != System.Reflection.MethodSemanticsAttributes.Other)
288288
return true;
289-
if (LocalFunctionDecompiler.IsLocalFunctionMethod(module, methodHandle))
290-
return settings.LocalFunctions;
289+
if (settings.LocalFunctions && LocalFunctionDecompiler.IsLocalFunctionMethod(module, methodHandle))
290+
return true;
291291
if (settings.AnonymousMethods && methodHandle.HasGeneratedName(metadata) && methodHandle.IsCompilerGenerated(metadata))
292292
return true;
293293
if (settings.AsyncAwait && AsyncAwaitDecompiler.IsCompilerGeneratedMainMethod(module, methodHandle))
@@ -299,8 +299,8 @@ public static bool MemberIsHidden(Metadata.PEFile module, EntityHandle member, D
299299
name = metadata.GetString(type.Name);
300300
if (!type.GetDeclaringType().IsNil)
301301
{
302-
if (LocalFunctionDecompiler.IsLocalFunctionDisplayClass(module, typeHandle))
303-
return settings.LocalFunctions;
302+
if (settings.LocalFunctions && LocalFunctionDecompiler.IsLocalFunctionDisplayClass(module, typeHandle))
303+
return true;
304304
if (settings.AnonymousMethods && IsClosureType(type, metadata))
305305
return true;
306306
if (settings.YieldReturn && YieldReturnDecompiler.IsCompilerGeneratorEnumerator(typeHandle, metadata))

0 commit comments

Comments
 (0)