[vala] GIR writer: Generate static methods correctly
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [vala] GIR writer: Generate static methods correctly
- Date: Thu, 30 Apr 2009 15:27:24 -0400 (EDT)
commit 0cb6ab426342d76d18354b815cd18bc05213d608
Author: Didier 'Ptitjes <ptitjes free fr>
Date: Fri Mar 20 17:25:19 2009 +0100
GIR writer: Generate static methods correctly
Signed-off-by: Didier 'Ptitjes <ptitjes free fr>
---
gobject/valagirwriter.vala | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gobject/valagirwriter.vala b/gobject/valagirwriter.vala
index 2c9b6e3..a1eb3a2 100644
--- a/gobject/valagirwriter.vala
+++ b/gobject/valagirwriter.vala
@@ -445,13 +445,23 @@ public class Vala.GIRWriter : CodeVisitor {
return;
}
+ string tag_name = "method";
+ var parent = m.parent_symbol;
+ if (parent is Namespace || m.binding == MemberBinding.STATIC) {
+ tag_name = "function";
+ }
+
+ write_signature (m, tag_name);
+ }
+
+ private void write_signature (Method m, string tag_name, bool instance = false) {
write_indent ();
- stream.printf ("<method name=\"%s\" c:identifier=\"%s\"", m.name, m.get_cname ());
+ stream.printf ("<%s name=\"%s\" c:identifier=\"%s\"", tag_name, m.name, m.get_cname ());
stream.printf (">\n");
indent++;
DataType instance_type = null;
- if (m.binding == MemberBinding.INSTANCE) {
+ if (instance) {
instance_type = CCodeBaseModule.get_data_type_for_symbol ((TypeSymbol) m.parent_symbol);
}
@@ -461,7 +471,7 @@ public class Vala.GIRWriter : CodeVisitor {
indent--;
write_indent ();
- stream.printf ("</method>\n");
+ stream.printf ("</%s>\n", tag_name);
}
public override void visit_creation_method (CreationMethod m) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]