Author: marek
Date: 2008-02-05 05:50:43 -0500 (Tue, 05 Feb 2008)
New Revision: 94865
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/cs-parser.jay
Log:
2008-02-05 Marek Safar <[EMAIL PROTECTED]>
A fix for bug #358374
* cs-parser.jay: Correctly set modifiers for all constructor types.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2008-02-05 10:36:39 UTC (rev 94864)
+++ trunk/mcs/mcs/ChangeLog 2008-02-05 10:50:43 UTC (rev 94865)
@@ -1,3 +1,8 @@
+2008-02-05 Marek Safar <[EMAIL PROTECTED]>
+
+ A fix for bug #358374
+ * cs-parser.jay: Correctly set modifiers for all constructor types.
+
2008-02-04 Marek Safar <[EMAIL PROTECTED]>
A fix for bug #355251
Modified: trunk/mcs/mcs/cs-parser.jay
===================================================================
--- trunk/mcs/mcs/cs-parser.jay 2008-02-05 10:36:39 UTC (rev 94864)
+++ trunk/mcs/mcs/cs-parser.jay 2008-02-05 10:50:43 UTC (rev 94865)
@@ -2342,35 +2342,26 @@
c.Block = (ToplevelBlock) $4;
c.OptAttributes = (Attributes) $1;
int yield_method = c.ModFlags & Modifiers.METHOD_YIELDS;
- c.ModFlags = (int) $2;
-
+ int mods = (int) $2;
+
if (RootContext.Documentation != null)
c.DocComment = ConsumeStoredComment ();
- if (c.Name == current_container.Basename){
- if ((c.ModFlags & Modifiers.STATIC) != 0){
- if ((c.ModFlags & Modifiers.Accessibility) !=
0){
- Report.Error (515, c.Location,
- "`{0}': access modifiers are
not allowed on static constructors",
- c.GetSignatureForError ());
- }
+ if ((mods & Modifiers.STATIC) != 0 && c.Name ==
current_container.Basename) {
+ if ((mods & Modifiers.Accessibility) != 0){
+ Report.Error (515, c.Location,
+ "`{0}': access modifiers are not
allowed on static constructors",
+ c.GetSignatureForError ());
+ }
- c.ModFlags = Modifiers.Check
(Constructor.AllowedModifiers, (int) $2, Modifiers.PRIVATE, c.Location);
-
- if (c.Initializer != null){
- Report.Error (514, c.Location,
- "`{0}': static constructor
cannot have an explicit `this' or `base' constructor call",
- c.GetSignatureForError ());
- }
- } else {
- c.ModFlags = Modifiers.Check
(Constructor.AllowedModifiers, (int) $2, Modifiers.PRIVATE, c.Location);
+ if (c.Initializer != null){
+ Report.Error (514, c.Location,
+ "`{0}': static constructor cannot have
an explicit `this' or `base' constructor call",
+ c.GetSignatureForError ());
}
- } else {
- // We let another layer check the validity of the
constructor.
- //Console.WriteLine ("{0} and {1}", c.Name,
current_container.Basename);
}
- c.ModFlags |= yield_method;
+ c.ModFlags = Modifiers.Check (Constructor.AllowedModifiers,
mods, Modifiers.PRIVATE, c.Location) | yield_method;
current_container.AddConstructor (c);
current_local_parameters = null;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches