From: Rico Tzschichholz Date: Wed, 16 Oct 2019 17:16:20 +0000 (+0200) Subject: girwriter: Restore behaviour for delegate-types X-Git-Tag: 0.47.1~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09432235d4784ed235f856dd202515e9e597740f;p=thirdparty%2Fvala.git girwriter: Restore behaviour for delegate-types Regression introduced by 061c02a91056b2f8c8b4cc985db4aec9c0a235fc --- 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 ("\n", get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*"); + } else if (type is DelegateType) { + var deleg_type = (DelegateType) type; + write_indent (); + buffer.append_printf ("\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 ("\n", is_array ? "array" : "type"); } - } else if (type is DelegateType) { - var deleg_type = (DelegateType) type; - write_indent (); - buffer.append_printf ("\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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1377,6 +1411,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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 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 { public GenericsTest (owned GirTest.DelegateTest cb); public void method (T param); + public GenericsTest.typed (owned GirTest.DelegateGenericsTest 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 g, T t); + [CCode (cheader_filename = "girtest.h")] public delegate bool DelegateTest (void* a, void* b); [CCode (cheader_filename = "girtest.h")] [GIR (visible = false)]