[vala] Error on usage of protected outside classes and interfaces



commit fac6cab7b829d4da933da5ac628d0d089d13bcd5
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Fri Jan 29 00:54:08 2010 +0100

    Error on usage of protected outside classes and interfaces
    
    Fixes bug 601347.

 vala/valamethod.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index ffd2a53..6089189 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) {



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