From 24a5ba0dc0be57146f6504679adf2527ed4a2802 Mon Sep 17 00:00:00 2001 From: Jonathan Matthew Date: Wed, 27 Oct 2010 19:11:13 +1000 Subject: scanner: support typedefs for container types Inside an alias definition, we only need the name of the alias target type. Add a method to GIRWriter to write out a type reference rather than full type definition and use it when writing out an alias. Determine introspectableness of aliases in IntrospectablePass so functions using aliases can be marked not-introspectable if the alias itself is not. https://bugzilla.gnome.org/show_bug.cgi?id=629682 --- giscanner/introspectablepass.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'giscanner/introspectablepass.py') diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py index 8aa7f8d3..4b35f7d9 100644 --- a/giscanner/introspectablepass.py +++ b/giscanner/introspectablepass.py @@ -31,6 +31,7 @@ class IntrospectablePass(object): # Public API def validate(self): + self._namespace.walk(self._introspectable_alias_analysis) self._namespace.walk(self._propagate_callable_skips) self._namespace.walk(self._analyze_node) self._namespace.walk(self._introspectable_callable_analysis) @@ -166,6 +167,12 @@ class IntrospectablePass(object): if target.skip: parent.skip = True + def _introspectable_alias_analysis(self, obj, stack): + if isinstance(obj, ast.Alias): + if not self._type_is_introspectable(obj.target): + obj.introspectable = False + return True + def _propagate_callable_skips(self, obj, stack): if isinstance(obj, ast.Callable): for param in obj.parameters: -- cgit v1.2.1