]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
GIR parser: Fix allow-none attribute parsing in fields and return values a1472539782383b3acc60c9ae5bbc7d16c0a826c
authorDidier 'Ptitjes <ptitjes@free.fr>
Tue, 28 Apr 2009 22:50:04 +0000 (00:50 +0200)
committerJürg Billeter <j@bitron.ch>
Thu, 7 May 2009 16:32:45 +0000 (18:32 +0200)
Signed-off-by: Didier 'Ptitjes <ptitjes@free.fr>
vapigen/valagirparser.vala

index 0912ab1be2b459372e9345e43304bd4e4168d8f4..ef24ca59c6af0e00b789f5320915cbe808bde363 100644 (file)
@@ -337,11 +337,15 @@ public class Vala.GirParser : CodeVisitor {
        DataType parse_return_value (out string? ctype = null) {
                start_element ("return-value");
                string transfer = reader.get_attribute ("transfer-ownership");
+               string allow_none = reader.get_attribute ("allow-none");
                next ();
                var type = &ctype != null ? parse_type(out ctype) : parse_type ();
                if (transfer == "full") {
                        type.value_owned = true;
                }
+               if (allow_none == "1") {
+                       type.nullable = true;
+               }
                end_element ("return-value");
                return type;
        }
@@ -681,10 +685,14 @@ public class Vala.GirParser : CodeVisitor {
        Field parse_field () {
                start_element ("field");
                string name = reader.get_attribute ("name");
+               string allow_none = reader.get_attribute ("allow-none");
                next ();
                var type = parse_type ();
                var field = new Field (name, type, null, get_current_src ());
                field.access = SymbolAccessibility.PUBLIC;
+               if (allow_none == "1") {
+                       type.nullable = true;
+               }
                end_element ("field");
                return field;
        }