]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vapigen: Support type_name attribute for signal return types
authorJürg Billeter <j@bitron.ch>
Mon, 25 Oct 2010 14:12:42 +0000 (16:12 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 25 Oct 2010 14:28:21 +0000 (16:28 +0200)
vapigen/valagidlparser.vala

index 917c5aead8bfe5fc64289a9047cf11c9904f1789..b2c4a5cfbb6db447258cb15b8c438203e0f81e8d 100644 (file)
@@ -2609,6 +2609,7 @@ public class Vala.GIdlParser : CodeVisitor {
                
                var attributes = get_attributes ("%s::%s".printf (current_data_type.get_cname (), sig.name));
                if (attributes != null) {
+                       string ns_name = null;
                        foreach (string attr in attributes) {
                                var nv = attr.split ("=", 2);
                                if (nv[0] == "name") {
@@ -2632,6 +2633,17 @@ public class Vala.GIdlParser : CodeVisitor {
                                        if (eval (nv[1]) == "1") {
                                                sig.return_type.value_owned = true;
                                        }
+                               } else if (nv[0] == "namespace_name") {
+                                       ns_name = eval (nv[1]);
+                               } else if (nv[0] == "type_name") {
+                                       var sym = new UnresolvedSymbol (null, eval (nv[1]));
+                                       if (sig.return_type is UnresolvedType) {
+                                               ((UnresolvedType) sig.return_type).unresolved_symbol = sym;
+                                       } else {
+                                               // Overwrite old return_type, so "type_name" must be before any
+                                               // other return type modifying metadata
+                                               sig.return_type = new UnresolvedType.from_symbol (sym, sig.return_type.source_reference);
+                                       }
                                } else if (nv[0] == "type_arguments") {
                                        var type_args = eval (nv[1]).split (",");
                                        foreach (string type_arg in type_args) {
@@ -2639,6 +2651,9 @@ public class Vala.GIdlParser : CodeVisitor {
                                        }
                                }
                        }
+                       if (ns_name != null) {
+                               ((UnresolvedType) sig.return_type).unresolved_symbol.inner = new UnresolvedSymbol (null, ns_name);
+                       }
                }
 
                sig.is_virtual = true;