]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
girparser: support return_void metadata argument
authorEvan Nemerson <evan@nemerson.com>
Mon, 26 May 2014 02:39:48 +0000 (19:39 -0700)
committerEvan Nemerson <evan@nemerson.com>
Wed, 28 May 2014 20:17:32 +0000 (13:17 -0700)
This allows us to generate backwards compatible signatures for
functions with a void return value and a single out param for a struct
from metadata files instead of resorting to *-custom.vala.

vala/valagirparser.vala

index b99cd5124f9e802206281c1869f680542015f32c..d60dffb01c8708f11bdcff4f43252081eb5efde4 100644 (file)
@@ -78,7 +78,8 @@ public class Vala.GirParser : CodeVisitor {
                INSTANCE_IDX,
                EXPERIMENTAL,
                FLOATING,
-               TYPE_ID;
+               TYPE_ID,
+               RETURN_VOID;
 
                public static ArgumentType? from_string (string name) {
                        var enum_class = (EnumClass) typeof(ArgumentType).class_ref ();
@@ -3440,8 +3441,10 @@ public class Vala.GirParser : CodeVisitor {
                                        if (last_param.param.variable_type is UnresolvedType) {
                                                var st = resolve_symbol (node.parent, ((UnresolvedType) last_param.param.variable_type).unresolved_symbol) as Struct;
                                                if (st != null && !st.is_simple_type () && !last_param.param.variable_type.nullable) {
-                                                       last_param.keep = false;
-                                                       return_type = last_param.param.variable_type.copy ();
+                                                       if (!node.metadata.get_bool (ArgumentType.RETURN_VOID, false)) {
+                                                               last_param.keep = false;
+                                                               return_type = last_param.param.variable_type.copy ();
+                                                       }
                                                }
                                        }
                                }