[gobject-introspection] scanner: Properly parse recursive list type nodes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] scanner: Properly parse recursive list type nodes
- Date: Wed, 5 Jan 2011 21:38:44 +0000 (UTC)
commit f99dee8efd9fd3125273b644b7ebea98626eb664
Author: Colin Walters <walters verbum org>
Date: Wed Jan 5 15:56:01 2011 -0500
scanner: Properly parse recursive list type nodes
Previously we were just looking for <type> inside a GLib.List,
but it may be <array>.
See bug 637262 for code that triggered this.
giscanner/girparser.py | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 800b257..6f6518c 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -95,10 +95,15 @@ class GIRParser(object):
# Private
- def _find_first_child(self, node, name):
- for child in node.getchildren():
- if child.tag == name:
- return child
+ def _find_first_child(self, node, name_or_names):
+ if isinstance(name_or_names, str):
+ for child in node.getchildren():
+ if child.tag == name_or_names:
+ return child
+ else:
+ for child in node.getchildren():
+ if child.tag in name_or_names:
+ return child
return None
def _find_children(self, node, name):
@@ -410,7 +415,7 @@ class GIRParser(object):
return ast.TypeUnknown()
return ast.Type(ctype=ctype)
elif name in ['GLib.List', 'GLib.SList']:
- subchild = self._find_first_child(typenode, _corens('type'))
+ subchild = self._find_first_child(typenode, map(_corens, ('callback', 'array', 'varargs', 'type')))
if subchild is not None:
element_type = self._parse_type(typenode)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]