mirror of https://github.com/icsharpcode/ILSpy.git
10 changed files with 231 additions and 16 deletions
@ -0,0 +1,6 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
[assembly: CLSCompliant(false)] |
@ -0,0 +1,31 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.NRefactory.CSharp; |
||||||
|
using Decompiler.Transforms; |
||||||
|
|
||||||
|
namespace ICSharpCode.Decompiler.Tests.Helpers |
||||||
|
{ |
||||||
|
class RemoveCompilerAttribute : DepthFirstAstVisitor<object, object>, IAstTransform |
||||||
|
{ |
||||||
|
public override object VisitAttribute(NRefactory.CSharp.Attribute attribute, object data) |
||||||
|
{ |
||||||
|
var section = (AttributeSection)attribute.Parent; |
||||||
|
SimpleType type = attribute.Type as SimpleType; |
||||||
|
if (section.AttributeTarget == AttributeTarget.Assembly && |
||||||
|
(type.Identifier == "CompilationRelaxationsAttribute" || type.Identifier == "RuntimeCompatibilityAttribute")) |
||||||
|
{ |
||||||
|
attribute.Remove(); |
||||||
|
if (section.Attributes.Count == 0) |
||||||
|
section.Remove(); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public void Run(AstNode node) |
||||||
|
{ |
||||||
|
node.AcceptVisitor(this, null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue