2 // Mono.ILASM.CustomAttr
5 // Jackson Harper (Jackson@LatitudeGeo.com)
7 // (C) 2003 Jackson Harper, All rights reserved
12 using System
.Collections
;
14 namespace Mono
.ILASM
{
16 public interface ICustomAttrTarget
{
17 void AddCustomAttribute (CustomAttr customattr
);
20 public class CustomAttr
{
22 private BaseMethodRef method_ref
;
25 public CustomAttr (BaseMethodRef method_ref
, byte[] data
)
27 this.method_ref
= method_ref
;
31 public void AddTo (CodeGen code_gen
, PEAPI
.MetaDataElement elem
)
33 method_ref
.Resolve (code_gen
);
34 code_gen
.PEFile
.AddCustomAttribute (method_ref
.PeapiMethod
, data
, elem
);
37 public bool IsSuppressUnmanaged (CodeGen codegen
)
41 BaseTypeRef owner
= method_ref
.Owner
;
45 ExternTypeRef etr
= owner
as ExternTypeRef
;
47 ExternAssembly ea
= etr
.ExternRef
as ExternAssembly
;
52 return (owner
.FullName
== "System.Security.SuppressUnmanagedCodeSecurityAttribute"
53 && (asmname
== "mscorlib" || codegen
.IsThisAssembly ("mscorlib")) );