[vala/switch-to-gir: 32/49] girparser: Add metadata argument to override scope attribute.



commit 8100fb8ca0703ad984f3d141f5c6f29b47f9e72e
Author: Luca Bruno <lucabru src gnome org>
Date:   Sun Dec 26 11:30:05 2010 +0100

    girparser: Add metadata argument to override scope attribute.

 vala/valagirparser.vala |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 9e2b863..431c511 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");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]