[vala] vapigen: Support is_array attribute for delegate parameters
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] vapigen: Support is_array attribute for delegate parameters
- Date: Tue, 20 Apr 2010 18:57:50 +0000 (UTC)
commit 73612ff3e0a65ef4f0976107fc4a69bd98caf942
Author: Travis Reitter <treitter gmail com>
Date: Tue Apr 20 20:55:35 2010 +0200
vapigen: Support is_array attribute for delegate parameters
Fixes bug 615971.
vapigen/valagidlparser.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 3f25d23..3547138 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -340,6 +340,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) {
@@ -350,13 +352,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") {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]