diff options
-rw-r--r-- | giscanner/introspectablepass.py | 19 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 30 | ||||
-rw-r--r-- | tests/scanner/regress.h | 16 |
3 files changed, 65 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 diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 8067b12d..3fce12b5 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -15,6 +15,18 @@ and/or use gtk-doc annotations. --> shared-library="libregress.so" c:identifier-prefixes="Regress" c:symbol-prefixes="regress"> + <record name="SkippedStructure" + c:type="RegressSkippedStructure" + introspectable="0"> + <doc xml:whitespace="preserve">This should be skipped, and moreover, all function which +use it should be.</doc> + <field name="x" writable="1"> + <type name="gint" c:type="int"/> + </field> + <field name="v" writable="1"> + <type name="gdouble" c:type="double"/> + </field> + </record> <record name="TestBoxed" c:type="RegressTestBoxed" glib:type-name="RegressTestBoxed" @@ -831,6 +843,24 @@ case.</doc> </parameter> </parameters> </function> + <function name="random_function_with_skipped_structure" + c:identifier="regress_random_function_with_skipped_structure" + introspectable="0"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="x" transfer-ownership="none"> + <type name="gint" c:type="int"/> + </parameter> + <parameter name="foo" transfer-ownership="none"> + <type name="SkippedStructure" c:type="RegressSkippedStructure*"/> + </parameter> + <parameter name="v" transfer-ownership="none"> + <type name="gdouble" c:type="double"/> + </parameter> + </parameters> + </function> <function name="set_abort_on_error" c:identifier="regress_set_abort_on_error"> <return-value transfer-ownership="none"> diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index a1b48f2d..6fed4ca7 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -508,4 +508,20 @@ void regress_test_torture_signature_2 (int x, GValue *regress_test_date_in_gvalue (void); GValue *regress_test_strv_in_gvalue (void); +/** + * RegressSkippedStructure: (skip) + * + * This should be skipped, and moreover, all function which + * use it should be. + */ +typedef struct +{ + int x; + double v; +} RegressSkippedStructure; + +void regress_random_function_with_skipped_structure (int x, + RegressSkippedStructure *foo, + double v); + #endif /* __GITESTTYPES_H__ */ |