+ foreach (Attribute a in attrs)
+ a.AttachTo (this, CodeGen.Assembly);
+
+ if (attributes == null) {
+ attributes = new Attributes (attrs);
+ return;
+ }
+
+ attributes.AddAttributes (attrs);
+ }
+
+ public override TypeContainer AddPartial (TypeContainer nextPart)
+ {
+ return AddPartial (nextPart, nextPart.Name);
+ }
+
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb, PredefinedAttributes pa)
+ {
+ if (a.Type == pa.CLSCompliant) {
+ if (CodeGen.Assembly.ClsCompliantAttribute == null) {
+ Report.Warning (3012, 1, a.Location, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
+ } else if (CodeGen.Assembly.IsClsCompliant != a.GetBoolean ()) {
+ Report.SymbolRelatedToPreviousError (CodeGen.Assembly.ClsCompliantAttribute.Location, CodeGen.Assembly.ClsCompliantAttribute.GetSignatureForError ());
+ Report.Warning (3017, 1, a.Location, "You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly");
+ return;
+ }
+ }
+
+ builder.SetCustomAttribute (cb);
+ }
+
+ public ModuleBuilder Builder {
+ get {
+ return builder;
+ }
+
+ set {
+ builder = value;
+ assembly = builder.Assembly;
+ }
+ }
+
+ public override CompilerContext Compiler {
+ get { return context; }
+ }
+
+ public override void Emit ()
+ {
+ if (OptAttributes != null)
+ OptAttributes.Emit ();
+
+ if (is_unsafe) {
+ Type t = TypeManager.CoreLookupType (context, "System.Security", "UnverifiableCodeAttribute", Kind.Class, true);
+ if (t != null) {
+ ConstructorInfo unverifiable_code_ctor = TypeManager.GetPredefinedConstructor (t, Location.Null, Type.EmptyTypes);
+ if (unverifiable_code_ctor != null)
+ builder.SetCustomAttribute (new CustomAttributeBuilder (unverifiable_code_ctor, new object [0]));
+ }
+ }