]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Add metadata argument to override scope attribute.
authorLuca Bruno <lucabru@src.gnome.org>
Sun, 26 Dec 2010 10:30:05 +0000 (11:30 +0100)
committerLuca Bruno <lucabru@src.gnome.org>
Mon, 4 Apr 2011 13:14:45 +0000 (15:14 +0200)
vala/valagirparser.vala

index 9e2b863518c368a3e1e853dfd179dc29e57ec873..431c511b2d3ba79e9ac104c095d29aee52723f26 100644 (file)
@@ -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");