diff options
Diffstat (limited to 'codegen/valaccodemethodcallmodule.vala')
-rw-r--r-- | codegen/valaccodemethodcallmodule.vala | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index 2c5be10c3..36286ffe7 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -243,28 +243,13 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), instance); } } else if (m != null && m.binding == MemberBinding.CLASS) { - var cl = (Class) m.parent_symbol; - var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (cl))); - - CCodeExpression klass; - if (ma.inner == null) { - if (get_this_type () == null) { - // Accessing the method from a static or class constructor - klass = new CCodeIdentifier ("klass"); - } else { - // Accessing the method from within an instance method - var k = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_GET_CLASS")); - k.add_argument (get_this_cexpression ()); - klass = k; - } - } else { - // Accessing the method of an instance - var k = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_GET_CLASS")); - k.add_argument (get_cvalue (ma.inner)); - klass = k; - } + assert (ma.inner is ClassAccess); + var klass = get_cvalue (ma.inner); + unowned Class cl = (Class) m.parent_symbol; + var cast = new CCodeFunctionCall (new CCodeIdentifier (get_ccode_class_type_function (cl))); cast.add_argument (klass); + in_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), cast); out_arg_map.set (get_param_pos (get_ccode_instance_pos (m)), cast); } |