From: Luca Bruno Date: Sun, 26 Dec 2010 10:30:05 +0000 (+0100) Subject: girparser: Add metadata argument to override scope attribute. X-Git-Tag: 0.13.0~282 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3c899f51363106bc202bcbdaebaf85fd87623e9;p=thirdparty%2Fvala.git girparser: Add metadata argument to override scope attribute. --- diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 9e2b86351..431c511b2 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -69,7 +69,8 @@ public class Vala.GirParser : CodeVisitor { REF, VFUNC_NAME, VIRTUAL, - ABSTRACT; + ABSTRACT, + SCOPE; public static ArgumentType? from_string (string name) { var enum_class = (EnumClass) typeof(ArgumentType).class_ref (); @@ -1262,11 +1263,11 @@ public class Vala.GirParser : CodeVisitor { } string? element_get_string (string attribute_name, ArgumentType arg_type) { - var str = metadata.get_string (arg_type); - if (str == null) { - str = reader.get_attribute (attribute_name); + if (metadata.has_argument (arg_type)) { + return metadata.get_string (arg_type); + } else { + return reader.get_attribute (attribute_name); } - return str; } /* @@ -1807,7 +1808,7 @@ public class Vala.GirParser : CodeVisitor { string allow_none = reader.get_attribute ("allow-none"); if (&scope != null) { - scope = reader.get_attribute ("scope"); + scope = element_get_string ("scope", ArgumentType.SCOPE); } string closure = reader.get_attribute ("closure");