]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Allow transformation of implicit array parameters to out or ref parameters
authorJürg Billeter <j@bitron.ch>
Tue, 17 Jun 2008 21:12:06 +0000 (21:12 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 17 Jun 2008 21:12:06 +0000 (21:12 +0000)
2008-06-17  Jürg Billeter  <j@bitron.ch>

* vapigen/valagidlparser.vala:

Allow transformation of implicit array parameters to out or ref
parameters

svn path=/trunk/; revision=1610

ChangeLog
vapigen/valagidlparser.vala

index 0b692b93da657d850d8c83e920b8fe359fd1d8b5..2c0766712d238b0b04b8abac96d5842ae242aeb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-17  Jürg Billeter  <j@bitron.ch>
+
+       * vapigen/valagidlparser.vala:
+
+       Allow transformation of implicit array parameters to out or ref
+       parameters
+
 2008-06-17  Jürg Billeter  <j@bitron.ch>
 
        * gobject/valaccodegenerator.vala:
index 98bbe56803970d20b3179456ae1b61ddee3539af..f7434dfa722d368547b5bab36928c39e6ebf9902 100644 (file)
@@ -1381,6 +1381,7 @@ public class Vala.GIdlParser : CodeVisitor {
                        double array_length_pos = 0;
                        bool set_delegate_target_pos = false;
                        double delegate_target_pos = 0;
+                       bool array_requested = false;
                        var attributes = get_attributes ("%s.%s".printf (symbol, param_node.name));
                        if (attributes != null) {
                                foreach (string attr in attributes) {
@@ -1390,14 +1391,25 @@ public class Vala.GIdlParser : CodeVisitor {
                                                        param_type = new ArrayType (param_type, 1, param_type.source_reference);
                                                        p.parameter_type = param_type;
                                                        p.direction = ParameterDirection.IN;
+                                                       array_requested = true;
                                                }
                                        } else if (nv[0] == "is_out") {
                                                if (eval (nv[1]) == "1") {
                                                        p.direction = ParameterDirection.OUT;
+                                                       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] == "nullable") {
                                                if (eval (nv[1]) == "1") {