[vala] Fix protected member access check in inner classes
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] Fix protected member access check in inner classes
- Date: Mon, 1 Feb 2010 16:42:47 +0000 (UTC)
commit c910653bd3a70ce3e5aad4139467739f61c31ffe
Author: Jürg Billeter <j bitron ch>
Date: Mon Feb 1 17:39:51 2010 +0100
Fix protected member access check in inner classes
vala/valamemberaccess.vala | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index a3ea746..6f7f510 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -550,9 +550,18 @@ public class Vala.MemberAccess : Expression {
member.used = true;
if (access == SymbolAccessibility.PROTECTED) {
- var subtype = (analyzer.current_class != null && analyzer.current_class.is_subtype_of ((TypeSymbol) member.parent_symbol));
+ var target_type = (TypeSymbol) member.parent_symbol;
- if (!subtype) {
+ bool in_subtype = false;
+ for (Symbol this_symbol = analyzer.current_symbol; this_symbol != null; this_symbol = this_symbol.parent_symbol) {
+ var cl = this_symbol as Class;
+ if (cl != null && cl.is_subtype_of (target_type)) {
+ in_subtype = true;
+ break;
+ }
+ }
+
+ if (!in_subtype) {
error = true;
Report.error (source_reference, "Access to protected member `%s' denied".printf (member.get_full_name ()));
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]