2003-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / mbas / attribute.cs
index 988c435b52fd42bf05d8405f96fdbd0e40ead498..bfe5a39da1d315cb6acddfeb61f9cb4724fc7f4d 100644 (file)
@@ -634,7 +634,7 @@ namespace Mono.CSharp {
 
                //
                // Applies the attributes to the `builder'.
-               //
+               //                                                                      
                public static void ApplyAttributes (EmitContext ec, object builder, object kind,
                                                    Attributes opt_attrs, Location loc)
                {
@@ -873,8 +873,7 @@ namespace Mono.CSharp {
                                mb.SetImplementationFlags (MethodImplAttributes.PreserveSig);
                        
                        return mb;
-               }
-               
+               }                       
        }
        
        public class AttributeSection {
@@ -906,5 +905,22 @@ namespace Mono.CSharp {
                        if (a != null)
                                AttributeSections.Add (a);
                }
+               
+               public void AddAttributeSection (AttributeSection a)
+               {
+                       if (a != null && !AttributeSections.Contains (a))
+                               AttributeSections.Add (a);
+               }
+               
+               public bool Contains (Type t)
+               {
+                       foreach (AttributeSection attr_section in AttributeSections){
+                               foreach (Attribute a in attr_section.Attributes){
+                                       if (a.Type == t)
+                                               return true;
+                               }
+                       }
+                       return false;
+               }                       
        }
 }