diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-05-04 09:21:10 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-05-04 09:21:10 +0200 |
commit | 8b8340a4392bdff429b99a465acd96a9630ee6b8 (patch) | |
tree | a821450e55c7dde25ba6aa86558636e9bbba9cbe /codegen/valaccodemethodcallmodule.vala | |
parent | 86fecf1dfee0808cd2fe759669e5f328e06ec228 (diff) | |
download | vala-8b8340a4392bdff429b99a465acd96a9630ee6b8.tar.gz |
codegen: More use of get_this_{class|interface}_cexpression()
Diffstat (limited to 'codegen/valaccodemethodcallmodule.vala')
-rw-r--r-- | codegen/valaccodemethodcallmodule.vala | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index 399a05721..95b4618c6 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -114,31 +114,14 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { var inner_ma = (MemberAccess) ma.inner; instance_value = inner_ma.inner.target_value; } - var pub_inst = get_cvalue_ (instance_value); - CCodeFunctionCall? vcast = null; + CCodeExpression? vcast = null; if (m.parent_symbol is Class) { unowned Class base_class = (Class) m.parent_symbol; - if (base_class.external_package) { - vcast = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_CLASS")); - vcast.add_argument (pub_inst); - vcast.add_argument (new CCodeIdentifier (get_ccode_type_id (base_class))); - vcast.add_argument (new CCodeIdentifier (get_ccode_type_name (base_class))); - } else { - vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_class))); - vcast.add_argument (pub_inst); - } + vcast = get_this_class_cexpression (base_class, instance_value); } else if (m.parent_symbol is Interface) { unowned Interface base_iface = (Interface) m.parent_symbol; - if (base_iface.external_package) { - vcast = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_INTERFACE")); - vcast.add_argument (pub_inst); - vcast.add_argument (new CCodeIdentifier (get_ccode_type_id (base_iface))); - vcast.add_argument (new CCodeIdentifier (get_ccode_type_name (base_iface))); - } else { - vcast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_type_get_function (base_iface))); - vcast.add_argument (pub_inst); - } + vcast = get_this_interface_cexpression (base_iface, instance_value); } if (vcast != null) { async_call.call = new CCodeMemberAccess.pointer (vcast, get_ccode_vfunc_name (m)); |