diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-03-31 14:33:10 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-06-24 14:14:38 +0200 |
commit | 9d7192bf11a946510d390a73bcce5a63064e24d4 (patch) | |
tree | 6abfe904b661288a459be4fea9e3e68a5fb48d54 /codegen | |
parent | c258c1da2e7a6b31aec11645d03a8f0e947eb59d (diff) | |
download | vala-9d7192bf11a946510d390a73bcce5a63064e24d4.tar.gz |
girwriter: Use "optional" and "nullable" instead of deprecated "allow-none"
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1131
Diffstat (limited to 'codegen')
-rw-r--r-- | codegen/valagirwriter.vala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala index d60c3da3d..2911e15db 100644 --- a/codegen/valagirwriter.vala +++ b/codegen/valagirwriter.vala @@ -1008,7 +1008,7 @@ public class Vala.GIRWriter : CodeVisitor { write_indent (); buffer.append_printf ("<field name=\"%s\"", get_ccode_name (f)); if (f.variable_type.nullable) { - buffer.append_printf (" allow-none=\"1\""); + buffer.append_printf (" nullable=\"1\""); } write_symbol_attributes (f); buffer.append_printf (">\n"); @@ -1560,7 +1560,12 @@ public class Vala.GIRWriter : CodeVisitor { buffer.append_printf (" caller-allocates=\"1\""); } if (type != null && type.nullable) { - buffer.append_printf (" allow-none=\"1\""); + if (tag == "parameter" + && (direction == ParameterDirection.OUT || direction == ParameterDirection.REF)) { + buffer.append_printf (" optional=\"1\""); + } else { + buffer.append_printf (" nullable=\"1\""); + } } if (delegate_type != null && delegate_type.delegate_symbol.has_target) { |