]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Actually treat GLib.Source as compact class
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 16 Jun 2018 14:05:47 +0000 (16:05 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 16 Jun 2018 14:10:56 +0000 (16:10 +0200)
Make sure to not create a new dedicated struct for derived types and
reference them as GSource.

See https://gitlab.gnome.org/GNOME/vala/issues/641

codegen/valagtypemodule.vala

index 500d506bc94de618f5158de1b3ea5003d35c4aa6..938bd176628c350a7727288f974a8f1d044d52cb 100644 (file)
@@ -87,7 +87,7 @@ public class Vala.GTypeModule : GErrorModule {
                        decl_space.add_type_declaration (new CCodeNewline ());
                }
 
-               if (cl.is_compact && cl.base_class != null && !is_gsource) {
+               if (cl.is_compact && cl.base_class != null) {
                        decl_space.add_type_declaration (new CCodeTypeDefinition (get_ccode_name (cl.base_class), new CCodeVariableDeclarator (get_ccode_name (cl))));
                } else {
                        decl_space.add_type_declaration (new CCodeTypeDefinition ("struct _%s".printf (get_ccode_name (cl)), new CCodeVariableDeclarator (get_ccode_name (cl))));
@@ -210,7 +210,6 @@ public class Vala.GTypeModule : GErrorModule {
 
                bool is_gtypeinstance = !cl.is_compact;
                bool is_fundamental = is_gtypeinstance && cl.base_class == null;
-               bool is_gsource = cl.base_class == gsource_type;
 
                var instance_struct = new CCodeStruct ("_%s".printf (get_ccode_name (cl)));
                var type_struct = new CCodeStruct ("_%sClass".printf (get_ccode_name (cl)));
@@ -286,7 +285,7 @@ public class Vala.GTypeModule : GErrorModule {
                        instance_struct.add_field ("int", "dummy");
                }
 
-               if (!cl.is_compact || cl.base_class == null || is_gsource) {
+               if (!cl.is_compact || cl.base_class == null) {
                        // derived compact classes do not have a struct
                        decl_space.add_type_definition (instance_struct);
                }