For legacy library author convenience, propagate (skip) on e.g.
structures to all callables which use them.
# 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)
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
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"
</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">
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__ */