diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2010-09-07 12:44:38 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2010-09-07 13:23:25 -0400 |
commit | d80c8a8c2d3343c5280c1549aa604eb88695272e (patch) | |
tree | db4dbbc1fd84d1873428ae76c8648938ec410b00 /giscanner | |
parent | a613283ee5f4a6a6a4e137bdd1de231d2a6210a0 (diff) |
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
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/girwriter.py | 1 | ||||
-rw-r--r-- | 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) |