diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-04-15 16:49:14 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2022-01-04 16:27:14 +0100 |
commit | a24f44294041cc87dd3cadab38e3caa919f774e0 (patch) | |
tree | d184b7382ce311dffaa19795720c17111d28a82c /vala/valacodewriter.vala | |
parent | d74400bfaae61a1e2c246382e627b0a9adf8c304 (diff) | |
download | vala-a24f44294041cc87dd3cadab38e3caa919f774e0.tar.gz |
Add native support to specify non default length-type for arrays
string[:long] foo = new string[:long] { "foo" };
This applies to generated bindings where this new syntax will be
picked up. It will apply a stricter variable type checking for
such array types.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/607
Diffstat (limited to 'vala/valacodewriter.vala')
-rw-r--r-- | vala/valacodewriter.vala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala index cb3bd998d..f9f1fccd1 100644 --- a/vala/valacodewriter.vala +++ b/vala/valacodewriter.vala @@ -1569,6 +1569,11 @@ public class Vala.CodeWriter : CodeVisitor { if (array_type != null && array_type.fixed_length) { write_string ("["); array_type.length.accept (this); + var length_type = array_type.length_type.to_qualified_string (current_scope); + if (length_type != "int") { + write_string (":"); + write_string (length_type); + } write_string ("]"); } } |