From: Luca Bruno Date: Thu, 3 Nov 2011 09:39:09 +0000 (+0100) Subject: girparser: Box structs when used in type arguments X-Git-Tag: 0.14.1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce73c16f8cc87b20a643501a26acc4255a5cbb4b;p=thirdparty%2Fvala.git girparser: Box structs when used in type arguments Fixes bug 663058. --- diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala index 21b63d717..1908a0527 100644 --- a/vala/valagirparser.vala +++ b/vala/valagirparser.vala @@ -1073,6 +1073,7 @@ public class Vala.GirParser : CodeVisitor { Set provided_namespaces = new HashSet (str_hash, str_equal); HashMap unresolved_symbols_map = new HashMap (unresolved_symbol_hash, unresolved_symbol_equal); ArrayList unresolved_gir_symbols = new ArrayList (); + ArrayList unresolved_type_arguments = new ArrayList (); /** * Parses all .gir source files in the specified code @@ -1095,6 +1096,7 @@ public class Vala.GirParser : CodeVisitor { resolve_gir_symbols (); create_new_namespaces (); + resolve_type_arguments (); root.process (this); @@ -2221,6 +2223,7 @@ public class Vala.GirParser : CodeVisitor { var element_type = parse_type (); element_type.value_owned = transfer_elements; type.add_type_argument (element_type); + unresolved_type_arguments.add (element_type); } end_element (is_array ? "array" : "type"); @@ -2964,6 +2967,22 @@ public class Vala.GirParser : CodeVisitor { } } + void resolve_type_arguments () { + // box structs in type arguments + foreach (var element_type in unresolved_type_arguments) { + TypeSymbol sym = null; + if (element_type is UnresolvedType) { + sym = (TypeSymbol) resolve_symbol (root, ((UnresolvedType) element_type).unresolved_symbol); + } else if (element_type.data_type != null) { + sym = element_type.data_type; + } + var st = sym as Struct; + if (st != null && !st.is_integer_type () && !st.is_floating_type ()) { + element_type.nullable = true; + } + } + } + void process_interface (Node iface_node) { /* Temporarily workaround G-I bug not adding GLib.Object prerequisite: ensure we have at least one instantiable prerequisite */ diff --git a/vapi/libsoup-2.4.vapi b/vapi/libsoup-2.4.vapi index 6ae2581c0..9991f3b4f 100644 --- a/vapi/libsoup-2.4.vapi +++ b/vapi/libsoup-2.4.vapi @@ -363,7 +363,7 @@ namespace Soup { public uint status_code { get; set; } public Soup.URI uri { get; set; } [HasEmitter] - public signal void content_sniffed (string object, GLib.HashTable p0); + public signal void content_sniffed (string content_type, GLib.HashTable @params); [HasEmitter] public virtual signal void finished (); [HasEmitter] @@ -379,7 +379,7 @@ namespace Soup { [HasEmitter] public virtual signal void wrote_body (); [HasEmitter] - public signal void wrote_body_data (Soup.Buffer object); + public signal void wrote_body_data (Soup.Buffer chunk); [HasEmitter] public virtual signal void wrote_chunk (); [HasEmitter] @@ -1198,19 +1198,19 @@ namespace Soup { [CCode (cheader_filename = "libsoup/soup.h")] public static bool value_array_to_args (GLib.ValueArray array, va_list args); [CCode (cheader_filename = "libsoup/soup.h")] - public static void value_hash_insert (GLib.HashTable hash, string key, GLib.Type type, ...); + public static void value_hash_insert (GLib.HashTable hash, string key, GLib.Type type, ...); [CCode (cheader_filename = "libsoup/soup.h")] - public static void value_hash_insert_vals (GLib.HashTable hash, ...); + public static void value_hash_insert_vals (GLib.HashTable hash, ...); [CCode (cheader_filename = "libsoup/soup.h")] - public static void value_hash_insert_value (GLib.HashTable hash, string key, GLib.Value value); + public static void value_hash_insert_value (GLib.HashTable hash, string key, GLib.Value value); [CCode (cheader_filename = "libsoup/soup.h")] - public static bool value_hash_lookup (GLib.HashTable hash, string key, GLib.Type type, ...); + public static bool value_hash_lookup (GLib.HashTable hash, string key, GLib.Type type, ...); [CCode (cheader_filename = "libsoup/soup.h")] - public static bool value_hash_lookup_vals (GLib.HashTable hash, ...); + public static bool value_hash_lookup_vals (GLib.HashTable hash, ...); [CCode (cheader_filename = "libsoup/soup.h")] - public static GLib.HashTable value_hash_new (); + public static GLib.HashTable value_hash_new (); [CCode (cheader_filename = "libsoup/soup.h")] - public static GLib.HashTable value_hash_new_with_vals (...); + public static GLib.HashTable value_hash_new_with_vals (...); [CCode (cheader_filename = "libsoup/soup.h")] [Deprecated (replacement = "XMLRPC.build_fault", since = "vala-0.12")] [PrintfFormat]