diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2017-11-27 15:25:02 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2017-12-09 14:29:36 +0100 |
commit | baedfd41c175cec089d685bea1316001cb3cb3e0 (patch) | |
tree | e73dffc77ba49978cc05a9eaa804ca4e9b64a70f /codegen | |
parent | 31d1b953401f99992307a962a702cf62c9b70f2a (diff) | |
download | vala-baedfd41c175cec089d685bea1316001cb3cb3e0.tar.gz |
codegen: Discover invalid member access to instance field
https://bugzilla.gnome.org/show_bug.cgi?id=790903
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/valaccodememberaccessmodule.vala | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala index 6baf828c8..673d46869 100644 --- a/codegen/valaccodememberaccessmodule.vala +++ b/codegen/valaccodememberaccessmodule.vala @@ -570,6 +570,14 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule { } inst = pub_inst; } + + if (inst == null) { + // FIXME Report this with proper source-reference on the vala side! + Report.error (field.source_reference, "Invalid access to instance member `%s'".printf (field.get_full_name ())); + result.cvalue = new CCodeInvalidExpression (); + return result; + } + if (instance_target_type.data_type.is_reference_type () || (instance != null && instance.value_type is PointerType)) { result.cvalue = new CCodeMemberAccess.pointer (inst, get_ccode_name (field)); } else { |