From: Marc-André Lureau Date: Thu, 28 Jan 2010 23:54:08 +0000 (+0100) Subject: Error on usage of protected outside classes and interfaces X-Git-Tag: 0.7.10~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fac6cab7b829d4da933da5ac628d0d089d13bcd5;p=thirdparty%2Fvala.git Error on usage of protected outside classes and interfaces Fixes bug 601347. --- diff --git a/vala/valamethod.vala b/vala/valamethod.vala index ffd2a53fc..608918909 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -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) {