From: Rico Tzschichholz Date: Sun, 13 Jan 2019 09:08:30 +0000 (+0100) Subject: codegen: Don't add data parameter for "instance_init" of compact classes X-Git-Tag: 0.43.5~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fkeep-around%2F28984f31f4e18aedb85d8bfa4f72552fccf83a1a;p=thirdparty%2Fvala.git codegen: Don't add data parameter for "instance_init" of compact classes See b5260359255637d77ebc367d26c853ac6459f67d --- diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala index ade38ab83..3cca7771b 100644 --- a/codegen/valaccodemethodcallmodule.vala +++ b/codegen/valaccodemethodcallmodule.vala @@ -880,7 +880,9 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule { if (m is CreationMethod && m.parent_symbol is Class && ((current_class.is_compact && current_class.base_class != null) || current_class.base_class == gsource_type)) { var cinitcall = new CCodeFunctionCall (new CCodeIdentifier ("%s_instance_init".printf (get_ccode_lower_case_name (current_class, null)))); cinitcall.add_argument (get_this_cexpression ()); - cinitcall.add_argument (new CCodeConstant ("NULL")); + if (!current_class.is_compact) { + cinitcall.add_argument (new CCodeConstant ("NULL")); + } ccode.add_expression (cinitcall); } } diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala index 4faf055c1..b247216c5 100644 --- a/codegen/valaccodemethodmodule.vala +++ b/codegen/valaccodemethodmodule.vala @@ -661,7 +661,9 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule { if (cl.base_class == null) { var cinitcall = new CCodeFunctionCall (new CCodeIdentifier ("%s_instance_init".printf (get_ccode_lower_case_name (cl, null)))); cinitcall.add_argument (get_this_cexpression ()); - cinitcall.add_argument (new CCodeConstant ("NULL")); + if (!cl.is_compact) { + cinitcall.add_argument (new CCodeConstant ("NULL")); + } ccode.add_expression (cinitcall); } } else { diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala index bf5ab237d..9bb8a3052 100644 --- a/codegen/valagtypemodule.vala +++ b/codegen/valagtypemodule.vala @@ -1637,7 +1637,9 @@ public class Vala.GTypeModule : GErrorModule { var func = new CCodeFunction ("%s_instance_init".printf (get_ccode_lower_case_name (cl, null))); func.add_parameter (new CCodeParameter ("self", "%s *".printf (get_ccode_name (cl)))); - func.add_parameter (new CCodeParameter ("klass", "gpointer")); + if (!cl.is_compact) { + func.add_parameter (new CCodeParameter ("klass", "gpointer")); + } func.modifiers = CCodeModifiers.STATIC; push_function (func);