[vala/staging] girwriter: Restore behaviour for delegate-types
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girwriter: Restore behaviour for delegate-types
- Date: Wed, 16 Oct 2019 17:33:08 +0000 (UTC)
commit 09432235d4784ed235f856dd202515e9e597740f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Oct 16 19:16:20 2019 +0200
girwriter: Restore behaviour for delegate-types
Regression introduced by 061c02a91056b2f8c8b4cc985db4aec9c0a235fc
codegen/valagirwriter.vala | 8 ++--
tests/girwriter/GirTest-1.0.gir-expected | 68 ++++++++++++++++++++++++++++++++
tests/girwriter/girtest.vala | 5 +++
tests/girwriter/girtest.vapi-expected | 3 ++
4 files changed, 80 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index e92ab1514..d65e8b80c 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1544,6 +1544,10 @@ public class Vala.GIRWriter : CodeVisitor {
} else if (type is PointerType) {
write_indent ();
buffer.append_printf ("<type name=\"gpointer\" c:type=\"%s%s\"/>\n", get_ccode_name
(type), direction == ParameterDirection.IN ? "" : "*");
+ } else if (type is DelegateType) {
+ var deleg_type = (DelegateType) type;
+ write_indent ();
+ buffer.append_printf ("<type name=\"%s\" c:type=\"%s%s\"/>\n", gi_type_name
(deleg_type.delegate_symbol), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
} else if (type.type_symbol != null) {
write_indent ();
string type_name = gi_type_name (type.type_symbol);
@@ -1568,10 +1572,6 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("</%s>\n", is_array ? "array" : "type");
}
- } else if (type is DelegateType) {
- var deleg_type = (DelegateType) type;
- write_indent ();
- buffer.append_printf ("<type name=\"%s\" c:type=\"%s%s\"/>\n", gi_type_name
(deleg_type.delegate_symbol), get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*");
} else if (type is GenericType) {
// generic type parameters not supported in GIR
write_indent ();
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 034f48418..387df18ae 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -1021,6 +1021,40 @@
</parameter>
</parameters>
</constructor>
+ <constructor name="typed" c:identifier="gir_test_generics_test_new_typed">
+ <return-value transfer-ownership="full">
+ <type name="GirTest.GenericsTest" c:type="GirTestGenericsTest*"/>
+ </return-value>
+ <parameters>
+ <parameter name="g_type" transfer-ownership="none">
+ <type name="GType" c:type="GType"/>
+ </parameter>
+ <parameter name="g_dup_func" transfer-ownership="none">
+ <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+ </parameter>
+ <parameter name="g_destroy_func" transfer-ownership="none">
+ <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+ </parameter>
+ <parameter name="t_type" transfer-ownership="none">
+ <type name="GType" c:type="GType"/>
+ </parameter>
+ <parameter name="t_dup_func" transfer-ownership="none">
+ <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+ </parameter>
+ <parameter name="t_destroy_func" transfer-ownership="none">
+ <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+ </parameter>
+ <parameter name="cb" transfer-ownership="none" closure="7" scope="notified"
destroy="8">
+ <type name="GirTest.DelegateGenericsTest"
c:type="GirTestDelegateGenericsTest"/>
+ </parameter>
+ <parameter name="cb_target" transfer-ownership="none" allow-none="1">
+ <type name="gpointer" c:type="void*"/>
+ </parameter>
+ <parameter name="cb_target_destroy_notify" transfer-ownership="none"
scope="call">
+ <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+ </parameter>
+ </parameters>
+ </constructor>
<method name="method" c:identifier="gir_test_generics_test_method">
<return-value transfer-ownership="full">
<type name="none"/>
@@ -1377,6 +1411,40 @@
</parameter>
</parameters>
</callback>
+ <callback name="DelegateGenericsTest" c:type="GirTestDelegateGenericsTest">
+ <return-value transfer-ownership="full">
+ <type name="gboolean" c:type="gboolean"/>
+ </return-value>
+ <parameters>
+ <parameter name="g_type" transfer-ownership="none">
+ <type name="GType" c:type="GType"/>
+ </parameter>
+ <parameter name="g_dup_func" transfer-ownership="none">
+ <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+ </parameter>
+ <parameter name="g_destroy_func" transfer-ownership="none">
+ <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+ </parameter>
+ <parameter name="t_type" transfer-ownership="none">
+ <type name="GType" c:type="GType"/>
+ </parameter>
+ <parameter name="t_dup_func" transfer-ownership="none">
+ <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+ </parameter>
+ <parameter name="t_destroy_func" transfer-ownership="none">
+ <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+ </parameter>
+ <parameter name="g" transfer-ownership="none" allow-none="1">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ <parameter name="t" transfer-ownership="none" allow-none="1">
+ <type name="gpointer" c:type="gpointer"/>
+ </parameter>
+ <parameter name="user_data" transfer-ownership="none" closure="8">
+ <type name="gpointer" c:type="void*"/>
+ </parameter>
+ </parameters>
+ </callback>
<callback name="SkippedDelegate" c:type="GirTestSkippedDelegate" introspectable="0">
<return-value transfer-ownership="full">
<type name="none"/>
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 3ace08a5b..7673706d9 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -79,6 +79,8 @@ namespace GirTest {
public delegate bool DelegateTest (void* a, void* b);
+ public delegate bool DelegateGenericsTest<G,T> (G g, T t);
+
[GIR (visible = false)]
public delegate void SkippedDelegate ();
@@ -279,6 +281,9 @@ namespace GirTest {
public GenericsTest (owned DelegateTest cb) {
}
+ public GenericsTest.typed (owned DelegateGenericsTest<G,T> cb) {
+ }
+
public void method (T param) {
}
}
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index 52d23d16a..854c2cfd5 100644
--- a/tests/girwriter/girtest.vapi-expected
+++ b/tests/girwriter/girtest.vapi-expected
@@ -22,6 +22,7 @@ namespace GirTest {
public class GenericsTest<G,T> {
public GenericsTest (owned GirTest.DelegateTest cb);
public void method (T param);
+ public GenericsTest.typed (owned GirTest.DelegateGenericsTest<G,T> cb);
}
[CCode (cheader_filename = "girtest.h")]
public class ImplementionTest : GLib.Object, GirTest.InterfaceTest {
@@ -162,6 +163,8 @@ namespace GirTest {
FISHY
}
[CCode (cheader_filename = "girtest.h")]
+ public delegate bool DelegateGenericsTest<G,T> (G g, T t);
+ [CCode (cheader_filename = "girtest.h")]
public delegate bool DelegateTest (void* a, void* b);
[CCode (cheader_filename = "girtest.h")]
[GIR (visible = false)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]