[vala/staging] girwriter: Add explicit writable attribute to all field elements
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] girwriter: Add explicit writable attribute to all field elements
- Date: Sun, 25 Jul 2021 15:09:58 +0000 (UTC)
commit f25b5b124124776eeab6e59396e91e93a9c11f1d
Author: Princeton Ferro <princetonferro gmail com>
Date: Wed Jul 14 23:52:59 2021 -0400
girwriter: Add explicit writable attribute to all field elements
This addresses issues with bindings to Vala structs.
codegen/valagirwriter.vala | 2 +-
tests/girwriter/GirTest-1.0.gir-expected | 32 ++++++++++++++++----------------
2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 4be2b370a..49a8112a2 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -1021,7 +1021,7 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
- buffer.append_printf ("<field name=\"%s\"", get_ccode_name (f));
+ buffer.append_printf ("<field name=\"%s\" writable=\"1\"", get_ccode_name (f));
if (f.variable_type.nullable) {
buffer.append_printf (" nullable=\"1\"");
}
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 6ff7247a4..74acb9b7b 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -97,7 +97,7 @@
<field name="priv" readable="0" private="1">
<type name="SubTypeTestPrivate" c:type="GirTestSubTypeTestPrivate*"/>
</field>
- <field name="array_field">
+ <field name="array_field" writable="1">
<array c:type="gchar**">
<type name="utf8" c:type="gchar*"/>
</array>
@@ -105,7 +105,7 @@
<field name="array_field_length1">
<type name="gint" c:type="gint"/>
</field>
- <field name="delegate_field">
+ <field name="delegate_field" writable="1">
<type name="GirTest.DelegateTest" c:type="GirTestDelegateTest"/>
</field>
<field name="delegate_field_target">
@@ -133,18 +133,18 @@
<field name="priv" readable="0" private="1">
<type name="ObjectTestPrivate" c:type="GirTestObjectTestPrivate*"/>
</field>
- <field name="field">
+ <field name="field" writable="1">
<type name="gint" c:type="gint"/>
</field>
- <field name="internal_field">
+ <field name="internal_field" writable="1">
<type name="gint" c:type="gint"/>
</field>
- <field name="fixed_array_field">
+ <field name="fixed_array_field" writable="1">
<array fixed-size="23" c:type="gint*">
<type name="gint" c:type="gint"/>
</array>
</field>
- <field name="nullable_field" nullable="1">
+ <field name="nullable_field" writable="1" nullable="1">
<type name="utf8" c:type="gchar*"/>
</field>
<constructor name="new" c:identifier="gir_test_object_test_new">
@@ -1812,10 +1812,10 @@
</record>
<record name="ImplementionTestPrivate" c:type="GirTestImplementionTestPrivate" disguised="1"/>
<record name="CompactClass">
- <field name="s">
+ <field name="s" writable="1">
<type name="utf8" c:type="gchar*"/>
</field>
- <field name="i">
+ <field name="i" writable="1">
<type name="gint" c:type="gint"/>
</field>
<constructor name="new" c:identifier="gir_test_compactclass_new">
@@ -1891,10 +1891,10 @@
</record>
<record name="RenamedClassPrivate" c:type="GirTestNamedClassPrivate" disguised="1"/>
<record name="RenamedCompactClass">
- <field name="s">
+ <field name="s" writable="1">
<type name="utf8" c:type="gchar*"/>
</field>
- <field name="i">
+ <field name="i" writable="1">
<type name="gint" c:type="gint"/>
</field>
<constructor name="new" c:identifier="gir_test_named_compactclass_new">
@@ -2744,10 +2744,10 @@
</field>
</record>
<record name="BoxedStruct" c:type="GirTestBoxedStruct" c:symbol-prefix="boxed_struct"
glib:type-name="GirTestBoxedStruct" glib:get-type="gir_test_boxed_struct_get_type">
- <field name="field_name">
+ <field name="field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
- <field name="internal_field_name">
+ <field name="internal_field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
<function name="init" c:identifier="gir_test_boxed_struct_init">
@@ -2772,10 +2772,10 @@
</method>
</record>
<record name="Struct" c:type="GirTestStruct" c:symbol-prefix="struct">
- <field name="field_name">
+ <field name="field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
- <field name="internal_field_name">
+ <field name="internal_field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
<function name="init" c:identifier="gir_test_struct_init">
@@ -2800,12 +2800,12 @@
</method>
</record>
<record name="SkippedStruct" c:type="GirTestSkippedStruct" c:symbol-prefix="skipped_struct"
glib:type-name="GirTestSkippedStruct" glib:get-type="gir_test_skipped_struct_get_type" introspectable="0">
- <field name="field_name">
+ <field name="field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
</record>
<record name="RenamedStruct" c:type="GirTestNamedStruct" c:symbol-prefix="named_struct"
glib:type-name="GirTestNamedStruct" glib:get-type="gir_test_named_struct_get_type">
- <field name="field_name">
+ <field name="field_name" writable="1">
<type name="gint" c:type="gint"/>
</field>
</record>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]