summaryrefslogtreecommitdiff
path: root/giscanner/gdumpparser.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/gdumpparser.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/gdumpparser.py')
-rw-r--r--giscanner/gdumpparser.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
index c0c4ef61..c0b13f4a 100644
--- a/giscanner/gdumpparser.py
+++ b/giscanner/gdumpparser.py
@@ -188,18 +188,12 @@ blob containing data gleaned from GObject's primitive introspection."""
if func.symbol == 'g_variant_get_gtype':
# We handle variants internally, see _initparse_gobject_record
return True
- if func.parameters:
- return False
- # GType *_get_type(void)
- rettype = func.retval.type
- if not (rettype.is_equiv(ast.TYPE_GTYPE)
- or rettype.target_giname == 'Gtk.Type'):
- message.warn("function returns '%r', not a GType" % (
- func.retval.type, ))
- return False
- self._get_type_functions.append(func.symbol)
- return True
+ if func.is_type_meta_function():
+ self._get_type_functions.append(func.symbol)
+ return True
+
+ return False
def _initparse_error_quark_function(self, func):
if (func.retval.type.ctype != 'GQuark'):