From: Geert Jordaens Date: Thu, 2 Aug 2012 09:08:01 +0000 (+0200) Subject: Improve error message for static access to instance variables X-Git-Tag: 0.17.4~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=808e45fd004ae6574ab1f3c8f30bb6a9889f6b93;p=thirdparty%2Fvala.git Improve error message for static access to instance variables Fixes bug 642254. --- diff --git a/vala/valabinaryexpression.vala b/vala/valabinaryexpression.vala index 07b3ee386..1457de335 100644 --- a/vala/valabinaryexpression.vala +++ b/vala/valabinaryexpression.vala @@ -243,6 +243,17 @@ public class Vala.BinaryExpression : Expression { return false; } + if (left.value_type is FieldPrototype) { + error = true; + Report.error (left.source_reference, "Access to instance member `%s' denied".printf (left.symbol_reference.get_full_name ())); + return false; + } + if (right.value_type is FieldPrototype) { + error = true; + Report.error (right.source_reference, "Access to instance member `%s' denied".printf (right.symbol_reference.get_full_name ())); + return false; + } + left.target_type = left.value_type.copy (); left.target_type.value_owned = false; right.target_type = right.value_type.copy ();