[vala] Report error when using instance method as argument in static methods
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Report error when using instance method as argument in static methods
- Date: Mon, 22 Mar 2010 22:13:48 +0000 (UTC)
commit 17028dcb59a9df29c1a1c71a1f1ed48f083f4b77
Author: Jürg Billeter <j bitron ch>
Date: Mon Mar 22 23:12:47 2010 +0100
Report error when using instance method as argument in static methods
Fixes bug 598839.
vala/valasemanticanalyzer.vala | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 130e2ca..818ea7d 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -566,6 +566,15 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
}
}
+ var ma = arg as MemberAccess;
+ if (ma != null && ma.prototype_access) {
+ // allow prototype access if target type is delegate without target
+ var deleg_type = arg.target_type as DelegateType;
+ if (deleg_type == null || deleg_type.delegate_symbol.has_target) {
+ Report.error (arg.source_reference, "Access to instance member `%s' denied".printf (arg.symbol_reference.get_full_name ()));
+ }
+ return false;
+ }
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]