]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vapigen: Support is_array attribute for delegate parameters
authorTravis Reitter <treitter@gmail.com>
Tue, 20 Apr 2010 18:55:35 +0000 (20:55 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 21 Apr 2010 12:40:07 +0000 (14:40 +0200)
Fixes bug 615971.

vapigen/valagidlparser.vala

index 9e8ddcbcd8301648cec07a2b0036759088dc5889..dd40d409f0a43f9c093aad5202cae55a011ba33d 100644 (file)
@@ -352,6 +352,8 @@ public class Vala.GIdlParser : CodeVisitor {
 
                                bool hide_param = false;
                                bool show_param = false;
+                               bool array_requested = false;
+                               bool out_requested = false;
                                attributes = get_attributes ("%s.%s".printf (node.name, param_node.name));
                                if (attributes != null) {
                                        foreach (string attr in attributes) {
@@ -362,13 +364,33 @@ public class Vala.GIdlParser : CodeVisitor {
                                                        } else if (eval (nv[1]) == "0") {
                                                                show_param = true;
                                                        }
+                                               } else if (nv[0] == "is_array") {
+                                                       if (eval (nv[1]) == "1") {
+                                                               param_type = new ArrayType (param_type, 1, param_type.source_reference);
+                                                               p.parameter_type = param_type;
+                                                               if (!out_requested) {
+                                                                       p.direction = ParameterDirection.IN;
+                                                               }
+                                                               array_requested = true;
+                                                       }
                                                } else if (nv[0] == "is_out") {
                                                        if (eval (nv[1]) == "1") {
                                                                p.direction = ParameterDirection.OUT;
+                                                               out_requested = true;
+                                                               if (!array_requested && param_type is ArrayType) {
+                                                                       var array_type = (ArrayType) param_type;
+                                                                       param_type = array_type.element_type;
+                                                                       p.parameter_type = param_type;
+                                                               }
                                                        }
                                                } else if (nv[0] == "is_ref") {
                                                        if (eval (nv[1]) == "1") {
                                                                p.direction = ParameterDirection.REF;
+                                                               if (!array_requested && param_type is ArrayType) {
+                                                                       var array_type = (ArrayType) param_type;
+                                                                       param_type = array_type.element_type;
+                                                                       p.parameter_type = param_type;
+                                                               }
                                                        }
                                                } else if (nv[0] == "takes_ownership") {
                                                        if (eval (nv[1]) == "1") {