]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Error on usage of protected outside classes and interfaces
authorMarc-André Lureau <marcandre.lureau@gmail.com>
Thu, 28 Jan 2010 23:54:08 +0000 (00:54 +0100)
committerJürg Billeter <j@bitron.ch>
Fri, 29 Jan 2010 17:56:02 +0000 (18:56 +0100)
Fixes bug 601347.

vala/valamethod.vala

index ffd2a53fc42a78590196fc5894055f3975b7153a..608918909d46274da5d8bc3fa47edb9227ad7492 100644 (file)
@@ -762,6 +762,12 @@ public class Vala.Method : Member {
                                Report.error (source_reference, "Methods may not be overridden outside of classes");
                                return false;
                        }
+               } else if (access == SymbolAccessibility.PROTECTED) {
+                       if (!(parent_symbol is Class) && !(parent_symbol is Interface)) {
+                               error = true;
+                               Report.error (source_reference, "Protected methods may not be declared outside of classes and interfaces");
+                               return false;
+                       }
                }
 
                if (is_abstract && body != null) {