[gobject-introspection] Go back to previously handling of static methods on non-GObjects
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Go back to previously handling of static methods on non-GObjects
- Date: Tue, 7 Sep 2010 17:54:26 +0000 (UTC)
commit d80c8a8c2d3343c5280c1549aa604eb88695272e
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Sep 7 12:44:38 2010 -0400
Go back to previously handling of static methods on non-GObjects
Previous to the scanner rewrite, static methods were only handled
for GObject subclasses. Go back to that for full compatibility
with existing bindings and code. See bug 572408 for the topic
of changing the API.
The code for writing out static methods for records and boxed is
left as future proofing, and the same handling is added for
interfaces.
https://bugzilla.gnome.org/show_bug.cgi?id=628967
giscanner/girwriter.py | 1 +
giscanner/maintransformer.py | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py
index f2074df..883e4e3 100644
--- a/giscanner/girwriter.py
+++ b/giscanner/girwriter.py
@@ -379,6 +379,7 @@ and/or use gtk-doc annotations. ''')
if isinstance(node, Class):
for method in sorted(node.constructors):
self._write_constructor(method)
+ if isinstance(node, (Class, Interface)):
for method in sorted(node.static_methods):
self._write_static_method(method)
for vfunc in sorted(node.virtual_methods):
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index dc09ae2..5493fcd 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -797,9 +797,16 @@ method or constructor of some type."""
if split is None:
return False
(node, funcname) = split
- if not isinstance(node, (ast.Class, ast.Interface,
- ast.Record, ast.Union, glibast.GLibBoxedOther)):
+
+ # We actually should treat static methods on a wider class of objects:
+ # ast.Class, ast.Interface, ast.Record, ast.Union, glibast.GLibBoxedOther
+ # But we stick to GLibObject for now for compatibility with existing code.
+ #
+ # See https://bugzilla.gnome.org/show_bug.cgi?id=572408
+ #
+ if not isinstance(node, glibast.GLibObject):
return False
+
self._namespace.float(func)
func.name = funcname
node.static_methods.append(func)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]