summaryrefslogtreecommitdiff
path: root/vala/valasymbol.vala
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2010-08-21 12:07:28 +0200
committerJürg Billeter <j@bitron.ch>2010-09-09 15:54:17 +0200
commitf870d093e3ad54bd2cbbdc35f958b69a24b2d2eb (patch)
treeb46670a6ef3e48d87107f730dc18b567015cbe88 /vala/valasymbol.vala
parentdb40a8ea5c4ff623ae87e2cbe82e7b5d63926f7d (diff)
downloadvala-f870d093e3ad54bd2cbbdc35f958b69a24b2d2eb.tar.gz
Improve performance of SemanticAnalyzer.is_type_accessible
Diffstat (limited to 'vala/valasymbol.vala')
-rw-r--r--vala/valasymbol.vala12
1 files changed, 12 insertions, 0 deletions
diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala
index a46112fac..9bea678e0 100644
--- a/vala/valasymbol.vala
+++ b/vala/valasymbol.vala
@@ -497,6 +497,18 @@ public abstract class Vala.Symbol : CodeNode {
return null;
}
+ // check whether this symbol is at least as accessible as the specified symbol
+ public bool is_accessible (Symbol sym) {
+ Scope sym_scope = sym.get_top_accessible_scope ();
+ Scope this_scope = this.get_top_accessible_scope ();
+ if ((sym_scope == null && this_scope != null)
+ || (sym_scope != null && !sym_scope.is_subscope_of (this_scope))) {
+ return false;
+ }
+
+ return true;
+ }
+
public virtual void add_namespace (Namespace ns) {
Report.error (ns.source_reference, "unexpected declaration");
}