vala r1913 - in trunk: . vala



Author: juergbi
Date: Sat Oct 25 07:44:04 2008
New Revision: 1913
URL: http://svn.gnome.org/viewvc/vala?rev=1913&view=rev

Log:
2008-10-25  JÃrg Billeter  <j bitron ch>

	* vala/valaparser.vala:

	Report error when using virtual method modifiers for static
	methods, fixes bug 556881


Modified:
   trunk/ChangeLog
   trunk/vala/valaparser.vala

Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala	(original)
+++ trunk/vala/valaparser.vala	Sat Oct 25 07:44:04 2008
@@ -2119,20 +2119,30 @@
 		} else if (ModifierFlags.CLASS in flags) {
 			method.binding = MemberBinding.CLASS;
 		}
-		if (ModifierFlags.ABSTRACT in flags) {
-			method.is_abstract = true;
-		}
-		if (ModifierFlags.VIRTUAL in flags) {
-			method.is_virtual = true;
-		}
-		if (ModifierFlags.OVERRIDE in flags) {
-			method.overrides = true;
-		}
-		if ((method.is_abstract && method.is_virtual)
-		    || (method.is_abstract && method.overrides)
-		    || (method.is_virtual && method.overrides)) {
-			throw new ParseError.SYNTAX (get_error ("only one of `abstract', `virtual', or `override' may be specified"));
+
+		if (method.binding == MemberBinding.INSTANCE) {
+			if (ModifierFlags.ABSTRACT in flags) {
+				method.is_abstract = true;
+			}
+			if (ModifierFlags.VIRTUAL in flags) {
+				method.is_virtual = true;
+			}
+			if (ModifierFlags.OVERRIDE in flags) {
+				method.overrides = true;
+			}
+			if ((method.is_abstract && method.is_virtual)
+			    || (method.is_abstract && method.overrides)
+			    || (method.is_virtual && method.overrides)) {
+				throw new ParseError.SYNTAX (get_error ("only one of `abstract', `virtual', or `override' may be specified"));
+			}
+		} else {
+			if (ModifierFlags.ABSTRACT in flags
+			    || ModifierFlags.VIRTUAL in flags
+			    || ModifierFlags.OVERRIDE in flags) {
+				throw new ParseError.SYNTAX (get_error ("the modifiers `abstract', `virtual', and `override' are not valid for static methods"));
+			}
 		}
+
 		if (ModifierFlags.INLINE in flags) {
 			method.is_inline = true;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]