2005-01-26 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Wed, 26 Jan 2005 08:47:32 +0000 (08:47 -0000)
committerMartin Baulig <martin@novell.com>
Wed, 26 Jan 2005 08:47:32 +0000 (08:47 -0000)
* class.cs (TypeContainer.AttributeTargets): Return the correct
AttributeTargets depending on our `Kind' instead of throwing an
exception; fixes #71632.

svn path=/trunk/mcs/; revision=39562

mcs/mcs/ChangeLog
mcs/mcs/class.cs

index 352abbcd51efae4e04d2d3743215373edc356b2b..9f13da3d53dd65068611c197d7b39171e92c63f6 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-26  Martin Baulig  <martin@ximian.com>
+
+       * class.cs (TypeContainer.AttributeTargets): Return the correct
+       AttributeTargets depending on our `Kind' instead of throwing an
+       exception; fixes #71632.
+
 2005-01-26  Marek Safar  <marek.safar@seznam.cz>
 
        Fix #71257
index d506eabbff3fc2971de165ada742457f4ebf6fd5..a1743872a6d08925e7e16df67c0940498ef13b58 100644 (file)
@@ -713,7 +713,16 @@ namespace Mono.CSharp {
 
                public override AttributeTargets AttributeTargets {
                        get {
-                               throw new NotSupportedException ();
+                               switch (Kind) {
+                               case Kind.Class:
+                                       return AttributeTargets.Class;
+                               case Kind.Struct:
+                                       return AttributeTargets.Struct;
+                               case Kind.Interface:
+                                       return AttributeTargets.Interface;
+                               default:
+                                       throw new NotSupportedException ();
+                               }
                        }
                }
 
@@ -2794,12 +2803,6 @@ namespace Mono.CSharp {
                        }
                }
 
-               public override AttributeTargets AttributeTargets {
-                       get {
-                               return AttributeTargets.Class;
-                       }
-               }
-
                public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
                {
                        if (a.UsageAttribute != null) {
@@ -2874,12 +2877,6 @@ namespace Mono.CSharp {
                        this.ModFlags |= Modifiers.SEALED;
                }
 
-               public override AttributeTargets AttributeTargets {
-                       get {
-                               return AttributeTargets.Struct;
-                       }
-               }
-
                public const TypeAttributes DefaultTypeAttributes =
                        TypeAttributes.SequentialLayout |
                        TypeAttributes.Sealed |
@@ -2936,12 +2933,6 @@ namespace Mono.CSharp {
                        return null;
                }
 
-               public override AttributeTargets AttributeTargets {
-                       get {
-                               return AttributeTargets.Interface;
-                       }
-               }
-
                public const TypeAttributes DefaultTypeAttributes =
                        TypeAttributes.AutoLayout |
                        TypeAttributes.Abstract |