From: Jürg Billeter Date: Mon, 22 Mar 2010 22:12:47 +0000 (+0100) Subject: Report error when using instance method as argument in static methods X-Git-Tag: 0.8.0~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17028dcb59a9df29c1a1c71a1f1ed48f083f4b77;p=thirdparty%2Fvala.git Report error when using instance method as argument in static methods Fixes bug 598839. --- diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 130e2ca4d..818ea7d50 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; }