summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-01-05 15:56:01 -0500
committerColin Walters <walters@verbum.org>2011-01-05 15:56:01 -0500
commitf99dee8efd9fd3125273b644b7ebea98626eb664 (patch)
tree903494c817180f6a8b246ca57a5a65b5c542d819 /giscanner/girparser.py
parente26bdd9809e6d8181bd3e73faf05e4dcdbe5c638 (diff)
downloadgobject-introspection-f99dee8efd9fd3125273b644b7ebea98626eb664.tar.gz
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.
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r--giscanner/girparser.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 800b2573..6f6518c3 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: