[vala] Enforce protected member restrictions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Enforce protected member restrictions
- Date: Fri, 29 Jan 2010 18:06:09 +0000 (UTC)
commit 9a06f450b9801c1f79e5819185e1af84e7dba3c5
Author: Marc-André Lureau <marcandre lureau gmail com>
Date: Fri Jan 29 00:56:46 2010 +0100
Enforce protected member restrictions
Fixes bug 592577.
vala/valamemberaccess.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index ceb2840..a3ea746 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -549,7 +549,15 @@ public class Vala.MemberAccess : Expression {
member.used = true;
- if (access == SymbolAccessibility.PRIVATE) {
+ if (access == SymbolAccessibility.PROTECTED) {
+ var subtype = (analyzer.current_class != null && analyzer.current_class.is_subtype_of ((TypeSymbol) member.parent_symbol));
+
+ if (!subtype) {
+ error = true;
+ Report.error (source_reference, "Access to protected member `%s' denied".printf (member.get_full_name ()));
+ return false;
+ }
+ } else if (access == SymbolAccessibility.PRIVATE) {
var target_type = member.parent_symbol;
bool in_target_type = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]