From: Rico Tzschichholz Date: Fri, 19 Oct 2018 15:21:39 +0000 (+0200) Subject: girwriter: Fix ctype of out/ref and array parameters X-Git-Tag: 0.43.1~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcac4aabd0ec6c492aeb34087673a26bebd8424a;p=thirdparty%2Fvala.git girwriter: Fix ctype of out/ref and array parameters --- diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala index 7c2ebc7f0..cab520ac6 100644 --- a/codegen/valagirwriter.vala +++ b/codegen/valagirwriter.vala @@ -1312,6 +1312,7 @@ public class Vala.GIRWriter : CodeVisitor { } else if (index != -1) { buffer.append_printf (" length=\"%i\"", index); } + buffer.append_printf (" c:type=\"%s%s\"", get_ccode_name (array_type.element_type), direction == ParameterDirection.IN ? "*" : "**"); buffer.append_printf (">\n"); indent++; @@ -1325,7 +1326,7 @@ public class Vala.GIRWriter : CodeVisitor { buffer.append_printf ("\n"); } else if (type is PointerType) { write_indent (); - buffer.append_printf ("\n", get_ccode_name (type)); + buffer.append_printf ("\n", get_ccode_name (type), direction == ParameterDirection.IN ? "" : "*"); } else if (type.data_type != null) { write_indent (); string type_name = gi_type_name (type.data_type); @@ -1353,7 +1354,7 @@ public class Vala.GIRWriter : CodeVisitor { } 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)); + 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 18f275596..2b372d3ba 100644 --- a/tests/girwriter/GirTest-1.0.gir-expected +++ b/tests/girwriter/GirTest-1.0.gir-expected @@ -217,7 +217,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -258,7 +258,7 @@ - + @@ -280,7 +280,7 @@ - + @@ -291,7 +291,7 @@ - + @@ -313,7 +313,7 @@ - + @@ -324,7 +324,7 @@ - + @@ -345,10 +345,10 @@ - + - + @@ -361,7 +361,7 @@ - + @@ -369,16 +369,16 @@ - + - + - + @@ -387,13 +387,13 @@ - + - + - +