2003-01-07 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Tue, 7 Jan 2003 21:10:23 +0000 (21:10 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Tue, 7 Jan 2003 21:10:23 +0000 (21:10 -0000)
* cs-parser.jay (constructor_declaration): Set the
Constructor.ModFlags before probing for it.  This makes the
compiler report 514, 515 and 132 (the code was there, but got
broken).

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

mcs/mcs/cs-parser.jay

index 9391a51e86ad115493ba1c4323a6d07a9b464248..d81d5035030053d89c99a796da72d132670ebbce 100755 (executable)
@@ -1380,16 +1380,18 @@ constructor_declaration
                Constructor c = (Constructor) $3;
                c.Block = (Block) $4;
                c.OptAttributes = (Attributes) $1;
+               c.ModFlags = (int) $2;
        
                if ((c.ModFlags & Modifiers.STATIC) != 0){
-                       c.ModFlags = Modifiers.Check (Constructor.AllowedModifiers, (int) $2, 0, c.Location);   
-
-                       if ((c.ModFlags & Modifiers.Accessibility) != 0) {
+                       if ((c.ModFlags & Modifiers.Accessibility) != 0){
                                Report.Error (
-                                       515, c.Location, 
-                                       "Access modifiers are not allowed on static constructors");
+                                       515, c.Location, String.Format (
+                                       "`{0}.{1}': static constructor can not have access modifiers",
+                                       c.Name, current_container.Name));
                        }
 
+                       c.ModFlags = Modifiers.Check (Constructor.AllowedModifiers, (int) $2, 0, c.Location);   
+
                        if (c.Initializer != null){
                                Report.Error (
                                        514, c.Location,