[vala/0.40] codegen: Actually treat GLib.Source as compact class
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] codegen: Actually treat GLib.Source as compact class
- Date: Wed, 20 Jun 2018 05:59:39 +0000 (UTC)
commit f57093a06c818e73e90b4e9beec791b1fda60021
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jun 16 16:05:47 2018 +0200
codegen: Actually treat GLib.Source as compact class
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 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index be991baa3..044619317 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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))));
@@ -212,7 +212,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)));
@@ -288,7 +287,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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]