[vala/staging: 2/3] girparser: Respect "fixed-size" of arrays
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 2/3] girparser: Respect "fixed-size" of arrays
- Date: Tue, 31 May 2016 15:06:04 +0000 (UTC)
commit 76374e251d12e3a5ed00efd74647984ed7c8408f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue May 31 16:50:21 2016 +0200
girparser: Respect "fixed-size" of arrays
vala/valagirparser.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index ec6371a..159ce9f 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -2484,6 +2484,7 @@ public class Vala.GirParser : CodeVisitor {
string type_name = reader.get_attribute ("name");
ctype = null;
+ var fixed_length = -1;
array_length_idx = -1;
no_array_length = true;
array_null_terminated = true;
@@ -2501,6 +2502,7 @@ public class Vala.GirParser : CodeVisitor {
array_null_terminated = false;
}
if (reader.get_attribute ("fixed-size") != null) {
+ fixed_length = int.parse (reader.get_attribute ("fixed-size"));
array_null_terminated = false;
}
if (reader.get_attribute ("c:type") == "GStrv") {
@@ -2514,7 +2516,13 @@ public class Vala.GirParser : CodeVisitor {
var element_type = parse_type ();
element_type.value_owned = transfer_elements;
end_element ("array");
- return new ArrayType (element_type, 1, src);
+
+ var array_type = new ArrayType (element_type, 1, src);
+ if (fixed_length > 0) {
+ array_type.fixed_length = true;
+ array_type.length = new IntegerLiteral (fixed_length.to_string ());
+ }
+ return array_type;
}
} else if (reader.name == "callback"){
parse_callback ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]