summaryrefslogtreecommitdiff
path: root/giscanner/girparser.py
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2012-08-28 02:46:23 +0200
committerGiovanni Campagna <gcampagna@src.gnome.org>2012-10-28 18:41:04 +0100
commit9ff28e6abab52506933fb560de1360e16d8d3880 (patch)
treeca5f30c68df77bf3b6de0f3756b35c4b3c579623 /giscanner/girparser.py
parent6fc366a66c58039aec345cc531c329729b6bce18 (diff)
downloadgobject-introspection-9ff28e6abab52506933fb560de1360e16d8d3880.tar.gz
Namespace: fix appending of nodes
Traverse appended nodes for methods, so that namespace.symbols contains all known symbols and not just global functions. Also, ensure that all relevant nodes are appended when parsing GIRs. https://bugzilla.gnome.org/show_bug.cgi?id=683046
Diffstat (limited to 'giscanner/girparser.py')
-rw-r--r--giscanner/girparser.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index eb53a3c4..34c9f3e4 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -247,10 +247,11 @@ class GIRParser(object):
'set-value-func', 'get-value-func']:
func_name = node.attrib.get(_glibns(func_id))
obj.__dict__[func_id.replace('-', '_')] = func_name
- self._namespace.append(obj)
if self._types_only:
+ self._namespace.append(obj)
return
+
for iface in self._find_children(node, _corens('implements')):
obj.interfaces.append(self._namespace.type_from_name(iface.attrib['name']))
for iface in self._find_children(node, _corens('prerequisite')):
@@ -278,6 +279,8 @@ class GIRParser(object):
for signal in self._find_children(node, _glibns('signal')):
obj.signals.append(self._parse_function_common(signal, ast.Signal, obj))
+ self._namespace.append(obj)
+
def _parse_callback(self, node):
callback = self._parse_function_common(node, ast.Callback)
self._namespace.append(callback)
@@ -480,9 +483,11 @@ class GIRParser(object):
get_type=node.attrib[_glibns('get-type')],
c_symbol_prefix=node.attrib.get(_cns('symbol-prefix')))
self._parse_generic_attribs(node, obj)
- self._namespace.append(obj)
+
if self._types_only:
+ self._namespace.append(obj)
return
+
for method in self._find_children(node, _corens('method')):
func = self._parse_function_common(method, ast.Function, obj)
func.is_method = True
@@ -493,6 +498,7 @@ class GIRParser(object):
for callback in self._find_children(node, _corens('callback')):
obj.fields.append(
self._parse_function_common(callback, ast.Callback, obj))
+ self._namespace.append(obj)
def _parse_field(self, node):
type_node = None
@@ -570,12 +576,14 @@ class GIRParser(object):
obj.error_domain = glib_error_domain
obj.ctype = ctype
self._parse_generic_attribs(node, obj)
- self._namespace.append(obj)
if self._types_only:
+ self._namespace.append(obj)
return
+
for member in self._find_children(node, _corens('member')):
members.append(self._parse_member(member))
for func_node in self._find_children(node, _corens('function')):
func = self._parse_function_common(func_node, ast.Function)
obj.static_methods.append(func)
+ self._namespace.append(obj)