]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GIR writer: Write user_data parameter for delegates 495cd714aca44534b1cec1fb71edb20a40ae47d0
authorAbderrahim Kitouni <a.kitouni@gmail.com>
Thu, 3 Dec 2009 20:10:28 +0000 (21:10 +0100)
committerJürg Billeter <j@bitron.ch>
Sun, 17 Jan 2010 12:48:35 +0000 (13:48 +0100)
codegen/valagirwriter.vala

index ee87ad48fc38c1fbd4ead2b4836000daed28a52d..5d1ca71e93e9773038d8981fa17b165839a0ff9d 100644 (file)
@@ -509,7 +509,7 @@ public class Vala.GIRWriter : CodeVisitor {
                }
        }
 
-       private void write_params_and_return (List<FormalParameter> params, DataType? return_type, bool return_array_length, bool constructor = false, DataType? instance_type = null) {
+       private void write_params_and_return (List<FormalParameter> params, DataType? return_type, bool return_array_length, bool constructor = false, DataType? instance_type = null, bool user_data = false) {
                int last_index = 0;
                if (params.size != 0 || instance_type != null || (return_type is ArrayType && return_array_length) || (return_type is DelegateType)) {
                        write_indent ();
@@ -530,6 +530,17 @@ public class Vala.GIRWriter : CodeVisitor {
                        last_index = index - 1;
                        write_implicit_params (return_type, ref index, return_array_length, "result", ParameterDirection.OUT);
 
+                       if (user_data) {
+                               write_indent ();
+                               stream.printf ("<parameter name=\"user_data\" transfer-ownership=\"none\" closure=\"%d\">\n", index);
+                               indent++;
+                               write_indent ();
+                               stream.printf ("<type name=\"any\" c:type=\"void*\"/>\n");
+                               indent--;
+                               write_indent ();
+                               stream.printf ("</parameter>\n");
+                       }
+
                        indent--;
                        write_indent ();
                        stream.printf ("</parameters>\n");
@@ -560,7 +571,7 @@ public class Vala.GIRWriter : CodeVisitor {
 
                write_annotations (cb);
 
-               write_params_and_return (cb.get_parameters (), cb.return_type, !cb.no_array_length);
+               write_params_and_return (cb.get_parameters (), cb.return_type, !cb.no_array_length, false, null, cb.has_target);
 
                indent--;
                write_indent ();