[vala/switch-to-gir] girparser: Remove all type arguments when using type_arguments metadata.



commit b8a6b57937823dcd15e43277a8af76ada6bdc15e
Author: Luca Bruno <lucabru src gnome org>
Date:   Tue Nov 9 11:53:48 2010 +0100

    girparser: Remove all type arguments when using type_arguments metadata.

 vala/valagirparser.vala                |   29 ++++++++++++-----------------
 vapi/packages/gio-2.0/Gio-2.0.metadata |    3 +++
 2 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 342184a..8dc98d2 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1156,37 +1156,32 @@ public class Vala.GirParser : CodeVisitor {
 		return str;
 	}
 
+	/*
+	 * The changed is a faster way to check whether the type has changed and it may affect the C declaration.
+	 * If type arguments change, the C declaration is not affected.
+	 */
 	DataType? element_get_type (DataType orig_type, bool owned_by_default, out bool changed = null) {
-		if (&changed != null) {
-			changed = false;
-		}
-
+		changed = false;
 		var type = orig_type;
 
 		if (metadata.has_argument (ArgumentType.TYPE)) {
 			var new_type = parse_type_from_string (metadata.get_string (ArgumentType.TYPE), owned_by_default, metadata.get_source_reference (ArgumentType.TYPE));
-			if (&changed != null) {
-				changed = true;
-			}
+			changed = true;
 			return new_type;
 		}
 
-		if (metadata.has_argument (ArgumentType.TYPE_ARGUMENTS)) {
-			parse_type_arguments_from_string (type, metadata.get_string (ArgumentType.TYPE_ARGUMENTS), metadata.get_source_reference (ArgumentType.TYPE_ARGUMENTS));
-			if (&changed != null) {
-				changed = true;
-			}
-		}
-
 		if (type is VoidType) {
 			return type;
 		}
 
+		if (metadata.has_argument (ArgumentType.TYPE_ARGUMENTS)) {
+			type.remove_all_type_arguments ();
+			parse_type_arguments_from_string (type, metadata.get_string (ArgumentType.TYPE_ARGUMENTS), metadata.get_source_reference (ArgumentType.TYPE_ARGUMENTS));
+		}
+
 		if (metadata.get_bool (ArgumentType.ARRAY)) {
 			type = new ArrayType (type, 1, type.source_reference);
-			if (&changed != null) {
-				changed = true;
-			}
+			changed = true;
 		}
 
 		if (owned_by_default) {
diff --git a/vapi/packages/gio-2.0/Gio-2.0.metadata b/vapi/packages/gio-2.0/Gio-2.0.metadata
index 86e4d24..bbc6ea7 100644
--- a/vapi/packages/gio-2.0/Gio-2.0.metadata
+++ b/vapi/packages/gio-2.0/Gio-2.0.metadata
@@ -8,6 +8,9 @@ FileOutputStream.seek.cancellable nullable
 
 // Re-check these
 SimpleAsyncResult.new_take_error skip
+AppLaunchContext
+	.get_display.files type_arguments="File"
+	.get_startup_notify_id.files type_arguments="File"
 
 /* OLD METADATA FOR REFERENCE
 GLib cprefix="G" lower_case_cprefix="g_" cheader_filename="gio/gio.h" gir_namespace="Gio" gir_version="2.0"



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