[vala/switch-to-gir] girparser: Support type argument for formal parameters
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/switch-to-gir] girparser: Support type argument for formal parameters
- Date: Thu, 26 Aug 2010 16:41:44 +0000 (UTC)
commit 87af3009e629d23a486e55e9a0ba0f31198485a6
Author: Luca Bruno <lethalman88 gmail com>
Date: Thu Aug 26 11:28:03 2010 +0200
girparser: Support type argument for formal parameters
vala/valagirparser.vala | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index f647dea..a502152 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1113,7 +1113,16 @@ public class Vala.GirParser : CodeVisitor {
param = new FormalParameter.with_ellipsis (get_current_src ());
end_element ("varargs");
} else {
- var type = parse_type (null, out array_length_idx, transfer == "full");
+ string ctype;
+ var type = parse_type (out ctype, out array_length_idx, transfer == "full");
+ if (metadata.has_argument (ArgumentType.TYPE)) {
+ // keep the parsed ctype
+ type = metadata.get_data_type (ArgumentType.TYPE, false);
+ } else {
+ // discard ctype, duplicated information
+ ctype = null;
+ }
+
if (transfer == "full" || transfer == "container" || destroy != null) {
type.value_owned = true;
}
@@ -1121,6 +1130,7 @@ public class Vala.GirParser : CodeVisitor {
type.nullable = true;
}
param = new FormalParameter (name, type, get_current_src ());
+ param.ctype = ctype;
if (direction == "out") {
param.direction = ParameterDirection.OUT;
} else if (direction == "inout") {
@@ -1776,6 +1786,10 @@ public class Vala.GirParser : CodeVisitor {
next ();
while (current_token == MarkupTokenType.START_ELEMENT) {
+ if (!push_metadata ()) {
+ continue;
+ }
+
int array_length_idx, closure_idx, destroy_idx;
string scope;
string default_param_name = null;
@@ -1801,6 +1815,7 @@ public class Vala.GirParser : CodeVisitor {
}
parameters.add (info);
+ pop_metadata ();
}
end_element ("parameters");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]