[vala] GIR writer: Generate allow-none attributes
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] GIR writer: Generate allow-none attributes
- Date: Thu, 30 Apr 2009 17:22:34 -0400 (EDT)
commit 9ff319ed826b2bd7abfd795d50b270bba5aa97d6
Author: Didier 'Ptitjes <ptitjes free fr>
Date: Sat Mar 21 04:22:24 2009 +0100
GIR writer: Generate allow-none attributes
Generate allow-none attributes on parameters, return values and fields.
Signed-off-by: Didier 'Ptitjes <ptitjes free fr>
---
gobject/valagirwriter.vala | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/gobject/valagirwriter.vala b/gobject/valagirwriter.vala
index 2a22e84..1ba0ea8 100644
--- a/gobject/valagirwriter.vala
+++ b/gobject/valagirwriter.vala
@@ -377,7 +377,11 @@ public class Vala.GIRWriter : CodeVisitor {
}
write_indent ();
- stream.printf ("<field name=\"%s\">\n", f.get_cname ());
+ stream.printf ("<field name=\"%s\"", f.get_cname ());
+ if (f.field_type.nullable) {
+ stream.printf (" allow-none=\"1\"");
+ }
+ stream.printf (">\n");
indent++;
write_type (f.field_type);
@@ -435,6 +439,9 @@ public class Vala.GIRWriter : CodeVisitor {
stream.printf (" transfer-ownership=\"none\"");
}
}
+ if (param.parameter_type.nullable) {
+ stream.printf (" allow-none=\"1\"");
+ }
stream.printf (">\n");
indent++;
@@ -603,6 +610,9 @@ public class Vala.GIRWriter : CodeVisitor {
} else {
stream.printf (" transfer-ownership=\"none\"");
}
+ if (type.nullable) {
+ stream.printf (" allow-none=\"1\"");
+ }
stream.printf (">\n");
indent++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]