summaryrefslogtreecommitdiff
path: root/giscanner/maintransformer.py
diff options
context:
space:
mode:
authorMatthew Booth <mbooth@redhat.com>2012-03-06 11:57:01 -0300
committerJohan Dahlin <jdahlin@litl.com>2012-03-06 11:57:22 -0300
commitab8a6d9694ebd79b202b470c3742e8d521faf722 (patch)
tree8a7552e3b24cbf12d8e52e8758b3b79c7e8a5608 /giscanner/maintransformer.py
parentc2fc7cb45243aa9e0e1e5569cc742f69c76a671a (diff)
downloadgobject-introspection-ab8a6d9694ebd79b202b470c3742e8d521faf722.tar.gz
Fix matching of methods named *_get_type()
The code which heuristically turned functions into class methods would always ignore any function called *_get_type or *_get_gtype. However, the code which looked for GI metadata functions to execute them was much more comprehensive, checking not just the name, but also that it had no parameters and that it returned a GType. This change abstracts the more comprehensive check into the Function class, and uses the same check in both places. https://bugzilla.gnome.org/show_bug.cgi?id=671218
Diffstat (limited to 'giscanner/maintransformer.py')
-rw-r--r--giscanner/maintransformer.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 3a35b0e7..7d274b34 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -955,10 +955,11 @@ _split_uscored_by_type(text_buffer_try_new) -> (ast.Class(TextBuffer), 'try_new'
def _pair_function(self, func):
"""Check to see whether a toplevel function should be a
method or constructor of some type."""
- if (func.symbol.endswith('_get_type')
- or func.symbol.endswith('_get_gtype')
- or func.symbol.startswith('_')):
+
+ # Ignore internal symbols and type metadata functions
+ if func.symbol.startswith('_') or func.is_type_meta_function():
return
+
(ns, subsymbol) = self._transformer.split_csymbol(func.symbol)
assert ns == self._namespace
if self._is_constructor(func, subsymbol):