From: Rico Tzschichholz Date: Wed, 31 Mar 2021 12:33:10 +0000 (+0200) Subject: girwriter: Use "optional" and "nullable" instead of deprecated "allow-none" X-Git-Tag: 0.53.1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d7192bf11a946510d390a73bcce5a63064e24d4;p=thirdparty%2Fvala.git girwriter: Use "optional" and "nullable" instead of deprecated "allow-none" Fixes https://gitlab.gnome.org/GNOME/vala/issues/1131 --- 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 ("\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) { diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected index d4bb4291e..13fa4a5ae 100644 --- a/tests/girwriter/GirTest-1.0.gir-expected +++ b/tests/girwriter/GirTest-1.0.gir-expected @@ -135,7 +135,7 @@ - + @@ -529,7 +529,7 @@ - + @@ -556,7 +556,7 @@ - + @@ -580,7 +580,7 @@ - + @@ -617,7 +617,7 @@ - + @@ -636,10 +636,10 @@ - + - + @@ -665,10 +665,10 @@ - + - + @@ -694,10 +694,10 @@ - + - + @@ -726,10 +726,10 @@ - + - + @@ -761,10 +761,10 @@ - + - + @@ -856,10 +856,10 @@ - + - + @@ -896,7 +896,7 @@ - + @@ -923,7 +923,7 @@ - + @@ -1089,10 +1089,10 @@ - + - + @@ -1125,10 +1125,10 @@ - + - + @@ -1185,10 +1185,10 @@ - + - + @@ -1229,7 +1229,7 @@ - + @@ -1403,10 +1403,10 @@ - + - + @@ -1435,10 +1435,10 @@ - + - + @@ -1500,10 +1500,10 @@ - + - + @@ -1540,7 +1540,7 @@ - + @@ -1567,7 +1567,7 @@ - + @@ -1667,10 +1667,10 @@ - + - + @@ -1727,10 +1727,10 @@ - + - + @@ -1771,7 +1771,7 @@ - + @@ -1898,7 +1898,7 @@ - + @@ -1935,7 +1935,7 @@ - + @@ -1954,7 +1954,7 @@ - + @@ -2092,10 +2092,10 @@ - + - + @@ -2121,10 +2121,10 @@ - + - + @@ -2185,10 +2185,10 @@ - + - + @@ -2217,10 +2217,10 @@ - + - + @@ -2276,10 +2276,10 @@ - + - + @@ -2316,7 +2316,7 @@ - + @@ -2343,7 +2343,7 @@ - + @@ -2457,10 +2457,10 @@ - + - + @@ -2511,10 +2511,10 @@ - + - + @@ -2568,10 +2568,10 @@ - + - + @@ -2612,7 +2612,7 @@ - + @@ -2713,7 +2713,7 @@ - + @@ -2741,7 +2741,7 @@ - + @@ -2757,10 +2757,10 @@ - + - + @@ -2796,10 +2796,10 @@ - + - +