|
|
|
@ -70,14 +70,14 @@ namespace ICSharpCode.Decompiler.Ast
@@ -70,14 +70,14 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
if (method != null) { |
|
|
|
|
if (method.IsGetter || method.IsSetter || method.IsAddOn || method.IsRemoveOn) |
|
|
|
|
return true; |
|
|
|
|
if (settings.AnonymousMethods && method.Name.StartsWith("<", StringComparison.Ordinal) && method.IsCompilerGenerated()) |
|
|
|
|
if (settings.AnonymousMethods && method.HasGeneratedName() && method.IsCompilerGenerated()) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TypeDefinition type = member as TypeDefinition; |
|
|
|
|
if (type != null) { |
|
|
|
|
if (type.DeclaringType != null) { |
|
|
|
|
if (settings.AnonymousMethods && type.Name.StartsWith("<>c__DisplayClass", StringComparison.Ordinal) && type.IsCompilerGenerated()) |
|
|
|
|
if (type.DeclaringType != null) { |
|
|
|
|
if (settings.AnonymousMethods && IsClosureType(type)) |
|
|
|
|
return true; |
|
|
|
|
if (settings.YieldReturn && YieldReturnDecompiler.IsCompilerGeneratorEnumerator(type)) |
|
|
|
|
return true; |
|
|
|
@ -91,10 +91,12 @@ namespace ICSharpCode.Decompiler.Ast
@@ -91,10 +91,12 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
|
|
|
|
|
FieldDefinition field = member as FieldDefinition; |
|
|
|
|
if (field != null) { |
|
|
|
|
if (field.IsCompilerGenerated()) { |
|
|
|
|
if (settings.AnonymousMethods && field.Name.StartsWith("CS$<>", StringComparison.Ordinal)) |
|
|
|
|
return true; |
|
|
|
|
if (settings.AutomaticProperties && field.Name.StartsWith("<", StringComparison.Ordinal) && field.Name.EndsWith("BackingField", StringComparison.Ordinal)) |
|
|
|
|
if (field.IsCompilerGenerated()) { |
|
|
|
|
if (settings.AnonymousMethods && IsAnonymousMethodCacheField(field)) |
|
|
|
|
return true; |
|
|
|
|
if (settings.AutomaticProperties && IsAutomaticPropertyBackingField(field)) |
|
|
|
|
return true; |
|
|
|
|
if (settings.SwitchStatementOnString && IsSwitchOnStringCache(field)) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
// event-fields are not [CompilerGenerated]
|
|
|
|
@ -104,6 +106,26 @@ namespace ICSharpCode.Decompiler.Ast
@@ -104,6 +106,26 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsSwitchOnStringCache(FieldDefinition field) |
|
|
|
|
{ |
|
|
|
|
return field.Name.StartsWith("<>f__switch", StringComparison.Ordinal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsAutomaticPropertyBackingField(FieldDefinition field) |
|
|
|
|
{ |
|
|
|
|
return field.HasGeneratedName() && field.Name.EndsWith("BackingField", StringComparison.Ordinal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsAnonymousMethodCacheField(FieldDefinition field) |
|
|
|
|
{ |
|
|
|
|
return field.Name.StartsWith("CS$<>", StringComparison.Ordinal) || field.Name.StartsWith("<>f__am", StringComparison.Ordinal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|