From 6cc9207cbdb1328c746e0899f459bb09d1e3e954 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Thu, 20 Feb 2014 02:35:23 +0100 Subject: doctool/Gjs: some more fixes for structs and unions Stop pretending we have fields on unions (only methods are supported). Add minimal support (ie, don't crash) to nested structures, that due to how ast works have namespace None (and the transformers hard-depend on that). Uncovered by GLib's GDoubleIEEE754, before I removed union fields. For some reason, RegressTestStructE (anonymous union) has a completely different behavior and generates a weird name, while RegressLikeGnomeKeyringSchema (array of unnamed structs) becomes array(gpointer). Bah, one should have methods anyway... --- giscanner/doctemplates/Gjs/class.tmpl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'giscanner/doctemplates/Gjs/class.tmpl') diff --git a/giscanner/doctemplates/Gjs/class.tmpl b/giscanner/doctemplates/Gjs/class.tmpl index d8433704..7694d726 100644 --- a/giscanner/doctemplates/Gjs/class.tmpl +++ b/giscanner/doctemplates/Gjs/class.tmpl @@ -1,6 +1,8 @@ <%inherit file="/class.tmpl"/> <%block name="synopsis"> - + \ +% if node.namespace is not None: + const ${namespace.name} = imports.gi.${namespace.name}; let ${formatter.to_lower_camel_case(node.name)} = new ${namespace.name}.${node.name}(\ @@ -18,4 +20,11 @@ let ${formatter.to_lower_camel_case(node.name)} = new ${namespace.name}.${node.n ${formatter.format_gboxed_constructor(node)}\ % endif ); - + \ +% else: +

+ This structure is inside ${node.parent.namespace.name}.${node.parent.name} + and can only be used as a field of that. +

+% endif +
-- cgit v1.2.1