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

Loading…
Cancel
Save