[vala/0.50] girparser: Discover our very own array length fields
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.50] girparser: Discover our very own array length fields
- Date: Sun, 28 Feb 2021 08:58:20 +0000 (UTC)
commit 8df862159c60d884dc229ac30a62374d29a76a32
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Jan 19 21:56:50 2021 +0100
girparser: Discover our very own array length fields
tests/girwriter/GirTest-1.0.metadata | 3 +--
tests/girwriter/girtest.vapigen-expected | 3 ++-
vala/valagirparser.vala | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/tests/girwriter/GirTest-1.0.metadata b/tests/girwriter/GirTest-1.0.metadata
index 37a3608d6..49ebef7d3 100644
--- a/tests/girwriter/GirTest-1.0.metadata
+++ b/tests/girwriter/GirTest-1.0.metadata
@@ -10,8 +10,7 @@ ObjectTest
.fixed_array_field unowned=false
.nullable_field unowned=false
SubTypeTest
- .array_field unowned=false array_length_field="array_field_length1"
- .array_field_length1 skip
+ .array_field unowned=false
.delegate_field unowned=false
.delegate_field_target* skip
nested_function name="nested" parent="GirTest.Nested"
diff --git a/tests/girwriter/girtest.vapigen-expected b/tests/girwriter/girtest.vapigen-expected
index a0d0cebe2..68bb68f90 100644
--- a/tests/girwriter/girtest.vapigen-expected
+++ b/tests/girwriter/girtest.vapigen-expected
@@ -127,8 +127,9 @@ namespace GirTest {
}
[CCode (cheader_filename = "girtest.h", type_id = "gir_test_sub_type_test_get_type ()")]
public class SubTypeTest : GirTest.TypeTest {
- [CCode (array_length = false, array_null_terminated = true)]
+ [CCode (array_length_cname = "array_field_length1")]
public string[] array_field;
+ public int array_field_length1;
public GirTest.DelegateTest delegate_field;
[CCode (has_construct_function = false)]
public SubTypeTest ();
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 4ddba9d59..e28aaf362 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1163,6 +1163,9 @@ public class Vala.GirParser : CodeVisitor {
array_length = parent.lookup ("num_%s".printf
(field.name));
if (array_length == null) {
array_length = parent.lookup
("%s_length".printf (field.name));
+ if (array_length == null) {
+ array_length = parent.lookup
("%s_length1".printf (field.name));
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]