From fac6cab7b829d4da933da5ac628d0d089d13bcd5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 29 Jan 2010 00:54:08 +0100 Subject: [PATCH] Error on usage of protected outside classes and interfaces Fixes bug 601347. --- vala/valamethod.vala | 6 ++++++ 1 file changed, 6 insertions(+) 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) { -- 2.47.3