]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: Box structs when used in type arguments
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 3 Nov 2011 09:39:09 +0000 (10:39 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 30 Nov 2011 13:54:11 +0000 (14:54 +0100)
Fixes bug 663058.

vala/valagirparser.vala
vapi/libsoup-2.4.vapi

index 21b63d7173e88f92c27ee61fd8ed5859ed513203..1908a0527dc3e59299957d0e9c69a9b706653711 100644 (file)
@@ -1073,6 +1073,7 @@ public class Vala.GirParser : CodeVisitor {
        Set<string> provided_namespaces = new HashSet<string> (str_hash, str_equal);
        HashMap<UnresolvedSymbol,Symbol> unresolved_symbols_map = new HashMap<UnresolvedSymbol,Symbol> (unresolved_symbol_hash, unresolved_symbol_equal);
        ArrayList<UnresolvedSymbol> unresolved_gir_symbols = new ArrayList<UnresolvedSymbol> ();
+       ArrayList<DataType> unresolved_type_arguments = new ArrayList<DataType> ();
 
        /**
         * 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 */
index 6ae2581c09fede711526355567eb4f10a140e1fe..9991f3b4fbf77e6bb19002cb74c10e0e8f5820a8 100644 (file)
@@ -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<void*,void*> p0);
+               public signal void content_sniffed (string content_type, GLib.HashTable<void*,void*> @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<string,GLib.Value> hash, string key, GLib.Type type, ...);
+       public static void value_hash_insert (GLib.HashTable<string,GLib.Value?> hash, string key, GLib.Type type, ...);
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static void value_hash_insert_vals (GLib.HashTable<string,GLib.Value> hash, ...);
+       public static void value_hash_insert_vals (GLib.HashTable<string,GLib.Value?> hash, ...);
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static void value_hash_insert_value (GLib.HashTable<string,GLib.Value> hash, string key, GLib.Value value);
+       public static void value_hash_insert_value (GLib.HashTable<string,GLib.Value?> hash, string key, GLib.Value value);
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static bool value_hash_lookup (GLib.HashTable<string,GLib.Value> hash, string key, GLib.Type type, ...);
+       public static bool value_hash_lookup (GLib.HashTable<string,GLib.Value?> hash, string key, GLib.Type type, ...);
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static bool value_hash_lookup_vals (GLib.HashTable<string,GLib.Value> hash, ...);
+       public static bool value_hash_lookup_vals (GLib.HashTable<string,GLib.Value?> hash, ...);
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static GLib.HashTable<string,GLib.Value> value_hash_new ();
+       public static GLib.HashTable<string,GLib.Value?> value_hash_new ();
        [CCode (cheader_filename = "libsoup/soup.h")]
-       public static GLib.HashTable<string,GLib.Value> value_hash_new_with_vals (...);
+       public static GLib.HashTable<string,GLib.Value?> value_hash_new_with_vals (...);
        [CCode (cheader_filename = "libsoup/soup.h")]
        [Deprecated (replacement = "XMLRPC.build_fault", since = "vala-0.12")]
        [PrintfFormat]