Browse Source

Don't show [AsyncStateMachine] attribute.

pull/344/head
Daniel Grunwald 13 years ago
parent
commit
45e327d53a
  1. 12
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  2. 2
      ICSharpCode.Decompiler/Tests/PropertiesAndEvents.cs
  3. 10
      ILSpy.sln

12
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -1348,6 +1348,7 @@ namespace ICSharpCode.Decompiler.Ast
static void ConvertCustomAttributes(AstNode attributedNode, ICustomAttributeProvider customAttributeProvider, string attributeTarget = null)
{
EntityDeclaration entityDecl = attributedNode as EntityDeclaration;
if (customAttributeProvider.HasCustomAttributes) {
var attributes = new List<ICSharpCode.NRefactory.CSharp.Attribute>();
foreach (var customAttribute in customAttributeProvider.CustomAttributes.OrderBy(a => a.AttributeType.FullName)) {
@ -1359,11 +1360,14 @@ namespace ICSharpCode.Decompiler.Ast
// don't show the ParamArrayAttribute (it's converted to the 'params' modifier)
continue;
}
if (customAttribute.AttributeType.Name == "DebuggerStepThroughAttribute" && customAttribute.AttributeType.Namespace == "System.Diagnostics") {
// don't show the attribute if the method is async
EntityDeclaration entityDecl = attributedNode as EntityDeclaration;
if (entityDecl != null && entityDecl.HasModifier(Modifiers.Async))
// if the method is async, remove [DebuggerStepThrough] and [Async
if (entityDecl != null && entityDecl.HasModifier(Modifiers.Async)) {
if (customAttribute.AttributeType.Name == "DebuggerStepThroughAttribute" && customAttribute.AttributeType.Namespace == "System.Diagnostics") {
continue;
}
if (customAttribute.AttributeType.Name == "AsyncStateMachineAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices") {
continue;
}
}
var attribute = new ICSharpCode.NRefactory.CSharp.Attribute();

2
ICSharpCode.Decompiler/Tests/PropertiesAndEvents.cs

@ -24,7 +24,7 @@ public class PropertiesAndEvents
public event EventHandler AutomaticEvent;
[field: NonSerialized]
public event EventHandler AutomaticEventWithInitializer = delegate
public event EventHandler AutomaticEventWithInitializer = delegate(object sender, EventArgs e)
{
};

10
ILSpy.sln

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.8657-Beta 2
# SharpDevelop 4.3.0.8807-alpha
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{F45DB999-7E72-4000-B5AD-3A7B485A0896}"
ProjectSection(SolutionItems) = postProject
doc\Command Line.txt = doc\Command Line.txt
@ -171,6 +171,14 @@ Global
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.Build.0 = Release|Any CPU
{53DCA265-3C3C-42F9-B647-F72BA678122B}.Release|x86.ActiveCfg = Release|Any CPU
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|x86.Build.0 = Debug|Any CPU
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Debug|x86.ActiveCfg = Debug|Any CPU
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|x86.Build.0 = Release|Any CPU
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}.Release|x86.ActiveCfg = Release|Any CPU
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Debug|x86.Build.0 = Debug|Any CPU
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Release|x86.Build.0 = Release|Any CPU
{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Loading…
Cancel
Save