Browse Source

Do a better job at detecting closure classes

pull/307/head
Jb Evain 14 years ago
parent
commit
7d7e7ca2ff
  1. 7
      ICSharpCode.Decompiler/Ast/AstBuilder.cs

7
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -77,7 +77,7 @@ namespace ICSharpCode.Decompiler.Ast
TypeDefinition type = member as TypeDefinition;
if (type != null) {
if (type.DeclaringType != null) {
if (settings.AnonymousMethods && type.HasGeneratedName() && type.IsCompilerGenerated())
if (settings.AnonymousMethods && IsClosureType(type))
return true;
if (settings.YieldReturn && YieldReturnDecompiler.IsCompilerGeneratorEnumerator(type))
return true;
@ -104,6 +104,11 @@ namespace ICSharpCode.Decompiler.Ast @@ -104,6 +104,11 @@ namespace ICSharpCode.Decompiler.Ast
return false;
}
static bool IsClosureType(TypeDefinition type)
{
return type.HasGeneratedName() && type.IsCompilerGenerated() && (type.Name.Contains("DisplayClass") || type.Name.Contains("AnonStorey"));
}
/// <summary>
/// Runs the C# transformations on the compilation unit.

Loading…
Cancel
Save