[vala/staging: 8/10] codegen: Improve adding of delegate target type declaration



commit c1bc4ac57bd65749077a0099a9bb8652072b0d7a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 21 20:20:59 2018 +0100

    codegen: Improve adding of delegate target type declaration

 codegen/valaccodebasemodule.vala     | 2 +-
 codegen/valaccodedelegatemodule.vala | 2 ++
 vapi/glib-2.0.vapi                   | 6 ++++++
 3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index a1fe8b3a0..1f43dcb13 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -506,7 +506,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        dbus_proxy_type = (TypeSymbol) glib_ns.scope.lookup ("DBusProxy");
 
-                       delegate_target_type = new CType ("gpointer");
+                       delegate_target_type = new StructValueType ((Struct) glib_ns.scope.lookup 
("pointer"));
                        destroy_notify = (Delegate) glib_ns.scope.lookup ("DestroyNotify");
                        delegate_target_destroy_type = new DelegateType (destroy_notify);
                } else {
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index a3170b835..fe1d6f6ce 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -37,6 +37,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
                        return;
                }
 
+               generate_type_declaration (new DelegateType (d), decl_space);
+
                string return_type_cname = get_ccode_name (d.return_type);
 
                if (d.return_type.is_real_non_null_struct_type ()) {
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 339020f15..67c7f1c1c 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1563,6 +1563,12 @@ public class string16 {
 
 [CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GLib", 
gir_version = "2.0")]
 namespace GLib {
+       [PointerType]
+       [GIR (fullname = "gpointer")]
+       [CCode (cname = "gpointer", const_cname = "gconstpointer", cheader_filename = "glib.h")]
+       public struct pointer {
+       }
+
        [CCode (lower_case_cprefix = "", cheader_filename = "math.h")]
        namespace Math {
                [CCode (cname = "G_E")]


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