diff options
author | Colin Walters <walters@verbum.org> | 2010-09-07 15:13:06 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-09-07 15:16:44 -0400 |
commit | 7b4425d68f9fc8e7d798af1539e71d88530ad944 (patch) | |
tree | 0f6b377315d5b6ce317f69678d456ba06cc32e70 /giscanner/introspectablepass.py | |
parent | 6452d18b7f800ae1688b6ce2e486c8be307895f8 (diff) | |
download | gobject-introspection-7b4425d68f9fc8e7d798af1539e71d88530ad944.tar.gz |
scanner: Automatically skip callables which contain a skipped node
For legacy library author convenience, propagate (skip) on e.g.
structures to all callables which use them.
Diffstat (limited to 'giscanner/introspectablepass.py')
-rw-r--r-- | giscanner/introspectablepass.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py index 6653c097..290f1d22 100644 --- a/giscanner/introspectablepass.py +++ b/giscanner/introspectablepass.py @@ -30,6 +30,7 @@ class IntrospectablePass(object): # Public API def validate(self): + self._namespace.walk(self._propagate_callable_skips) self._namespace.walk(self._analyze_node) self._namespace.walk(self._introspectable_callable_analysis) self._namespace.walk(self._introspectable_callable_analysis) @@ -143,6 +144,24 @@ class IntrospectablePass(object): return False return target.introspectable and (not target.skip) + def _propagate_parameter_skip(self, parent, node): + if node.type.target_giname is not None: + target = self._transformer.lookup_typenode(node.type) + if target is None: + return + else: + return + + if target.skip: + parent.skip = True + + def _propagate_callable_skips(self, obj, stack): + if isinstance(obj, ast.Callable): + for param in obj.parameters: + self._propagate_parameter_skip(obj, param) + self._propagate_parameter_skip(obj, obj.retval) + return True + def _analyze_node(self, obj, stack): if obj.skip: return False |