[vala/staging] codegen: Don't add data parameter for "instance_init" of compact classes



commit 28984f31f4e18aedb85d8bfa4f72552fccf83a1a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Jan 13 10:08:30 2019 +0100

    codegen: Don't add data parameter for "instance_init" of compact classes
    
    See b5260359255637d77ebc367d26c853ac6459f67d

 codegen/valaccodemethodcallmodule.vala | 4 +++-
 codegen/valaccodemethodmodule.vala     | 4 +++-
 codegen/valagtypemodule.vala           | 4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)
---
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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]