[vala] vapigen: Support type_name attribute for signal return types
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] vapigen: Support type_name attribute for signal return types
- Date: Mon, 25 Oct 2010 14:45:12 +0000 (UTC)
commit 598d95ad06be35bc09cd61775b643204a1642244
Author: Jürg Billeter <j bitron ch>
Date: Mon Oct 25 16:12:42 2010 +0200
vapigen: Support type_name attribute for signal return types
vapigen/valagidlparser.vala | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 917c5ae..b2c4a5c 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]