2004-06-13 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Sun, 13 Jun 2004 02:20:09 +0000 (02:20 -0000)
committerMartin Baulig <martin@novell.com>
Sun, 13 Jun 2004 02:20:09 +0000 (02:20 -0000)
* cs-parser.jay: Don't allow generic attributes.

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

mcs/gmcs/ChangeLog
mcs/gmcs/cs-parser.jay
mcs/gmcs/decl.cs

index 96eb152c4056cb1b5a441a74d2b6a966554a9e73..8ee50ee09c54c6a70b987cf908d2d6e6bf4f3dc9 100755 (executable)
@@ -1,3 +1,7 @@
+2004-06-13  Martin Baulig  <martin@ximian.com>
+
+       * cs-parser.jay: Don't allow generic attributes.
+
 2004-06-13  Martin Baulig  <martin@ximian.com>
 
        * class.cs (MemberBase.DoDefineBase): New protected method.
index 40fedb695b8f0dd2a0dd1f85844fb1293eee69e6..968e4c2c05986d445e357dc32155cfdd836eb5fc 100755 (executable)
@@ -591,8 +591,13 @@ attribute
          }
          opt_attribute_arguments
          {
-               string name = ((MemberName) $1).GetName ();
+               MemberName mname = (MemberName) $1;
+               if (mname.IsGeneric) {
+                       Report.Error (404, lexer.Location,
+                                     "'<' unexpected: attributes cannot be generic");
+               }
 
+               string name = mname.GetName ();
                if (current_attr_target == "assembly" || current_attr_target == "module")
                        $$ = new GlobalAttribute (current_container, current_attr_target,
                                                  name, (ArrayList) $3, (Location) $2);
index 8f8a7781478a5c950741000424bf1e7a635f90a1..f448efee078b4e11ed424922ffcce7b11095a3d7 100755 (executable)
@@ -58,6 +58,17 @@ namespace Mono.CSharp {
                                return Name;
                }
 
+               public bool IsGeneric {
+                       get {
+                               if (TypeArguments != null)
+                                       return true;
+                               else if (Left != null)
+                                       return Left.IsGeneric;
+                               else
+                                       return false;
+                       }
+               }
+
                public string GetName (bool is_generic)
                {
                        string name = is_generic ? Basename : Name;