Browse Source

Print a custom attribute's positional arguments.

pull/52/head
Artur Zgodziski 15 years ago
parent
commit
7e5e94534c
  1. 6
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  2. 6
      ICSharpCode.Decompiler/Tests/CustomAttributes.cs
  3. 2
      NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs

6
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -578,10 +578,14 @@ namespace Decompiler @@ -578,10 +578,14 @@ namespace Decompiler
foreach (var customAttribute in customAttributeProvider.CustomAttributes)
{
ICSharpCode.NRefactory.CSharp.Attribute attribute = new ICSharpCode.NRefactory.CSharp.Attribute();
//customAttribute.
attribute.Type = ConvertType(customAttribute.AttributeType);
section.Attributes.Add(attribute);
foreach (var parameter in customAttribute.ConstructorArguments)
{
attribute.Arguments.Add(new PrimitiveExpression(parameter.Value));
}
}
attributedNode.Attributes.Add(section);

6
ICSharpCode.Decompiler/Tests/CustomAttributes.cs

@ -9,7 +9,11 @@ public static class CustomAtributes @@ -9,7 +9,11 @@ public static class CustomAtributes
[Flags]
public enum EnumWithFlag
{
Item1,
// Item1,
Item2
}
[Obsolete("some message")]
public static void ObsoletedMethod()
{
}
}

2
NRefactory/ICSharpCode.NRefactory/CSharp/Ast/GeneralScope/Attribute.cs

@ -25,12 +25,14 @@ @@ -25,12 +25,14 @@
// THE SOFTWARE.
using System.Collections.Generic;
using System.Diagnostics;
namespace ICSharpCode.NRefactory.CSharp
{
/// <summary>
/// Attribute(Arguments)
/// </summary>
[DebuggerDisplay("Attribute {Type}")]
public class Attribute : AstNode
{
public override NodeType NodeType {

Loading…
Cancel
Save