From: Didier 'Ptitjes Date: Tue, 28 Apr 2009 22:50:04 +0000 (+0200) Subject: GIR parser: Fix allow-none attribute parsing in fields and return values X-Git-Tag: 0.7.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fkeep-around%2Fa1472539782383b3acc60c9ae5bbc7d16c0a826c;p=thirdparty%2Fvala.git GIR parser: Fix allow-none attribute parsing in fields and return values Signed-off-by: Didier 'Ptitjes --- diff --git a/vapigen/valagirparser.vala b/vapigen/valagirparser.vala index 0912ab1be..ef24ca59c 100644 --- a/vapigen/valagirparser.vala +++ b/vapigen/valagirparser.vala @@ -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; }