diff options
-rw-r--r-- | girepository/girnode.c | 1 | ||||
-rw-r--r-- | girepository/girnode.h | 1 | ||||
-rw-r--r-- | girepository/girparser.c | 7 | ||||
-rw-r--r-- | girepository/girwriter.c | 3 | ||||
-rw-r--r-- | girepository/gitypelib-internal.h | 3 | ||||
-rw-r--r-- | girepository/gitypes.h | 4 | ||||
-rw-r--r-- | girepository/givfuncinfo.c | 3 | ||||
-rw-r--r-- | tests/gimarshallingtests.c | 12 | ||||
-rw-r--r-- | tests/gimarshallingtests.h | 7 |
9 files changed, 38 insertions, 3 deletions
diff --git a/girepository/girnode.c b/girepository/girnode.c index fcc8ce5e..c5a70486 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -1784,6 +1784,7 @@ _g_ir_node_build_typelib (GIrNode *node, blob->must_be_implemented = 0; /* FIXME */ blob->must_not_be_implemented = 0; /* FIXME */ blob->class_closure = 0; /* FIXME */ + blob->throws = vfunc->throws; blob->reserved = 0; if (vfunc->invoker) diff --git a/girepository/girnode.h b/girepository/girnode.h index 32863455..018261ae 100644 --- a/girepository/girnode.h +++ b/girepository/girnode.h @@ -206,6 +206,7 @@ struct _GIrNodeVFunc gboolean must_be_implemented; gboolean must_not_be_implemented; gboolean is_class_closure; + gboolean throws; char *invoker; diff --git a/girepository/girparser.c b/girepository/girparser.c index fd742f94..b5c4ee32 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -2345,6 +2345,7 @@ start_vfunc (GMarkupParseContext *context, const gchar *is_class_closure; const gchar *offset; const gchar *invoker; + const gchar *throws; GIrNodeInterface *iface; GIrNodeVFunc *vfunc; @@ -2362,6 +2363,7 @@ start_vfunc (GMarkupParseContext *context, is_class_closure = find_attribute ("is-class-closure", attribute_names, attribute_values); offset = find_attribute ("offset", attribute_names, attribute_values); invoker = find_attribute ("invoker", attribute_names, attribute_values); + throws = find_attribute ("throws", attribute_names, attribute_values); if (name == NULL) { @@ -2400,6 +2402,11 @@ start_vfunc (GMarkupParseContext *context, else vfunc->is_class_closure = FALSE; + if (throws && strcmp (throws, "1") == 0) + vfunc->throws = TRUE; + else + vfunc->throws = FALSE; + if (offset) vfunc->offset = atoi (offset); else diff --git a/girepository/girwriter.c b/girepository/girwriter.c index d9f916c5..7f5f7e87 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -916,6 +916,9 @@ write_vfunc_info (const gchar *namespace, else if (flags & GI_VFUNC_MUST_NOT_OVERRIDE) xml_printf (file, " override=\"never\""); + if (flags & GI_VFUNC_THROWS) + xml_printf (file, " throws=\"1\""); + xml_printf (file, " offset=\"%d\"", offset); if (invoker) diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h index f450a2fb..c6575d67 100644 --- a/girepository/gitypelib-internal.h +++ b/girepository/gitypelib-internal.h @@ -925,7 +925,8 @@ typedef struct { guint16 must_be_implemented : 1; guint16 must_not_be_implemented : 1; guint16 class_closure : 1; - guint16 reserved :12; + guint16 throws : 1; + guint16 reserved :11; guint16 signal; guint16 struct_offset; diff --git a/girepository/gitypes.h b/girepository/gitypes.h index cbe43168..f83ea8bc 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -403,6 +403,7 @@ typedef enum * @GI_VFUNC_MUST_CHAIN_UP: chains up to the parent type * @GI_VFUNC_MUST_OVERRIDE: overrides * @GI_VFUNC_MUST_NOT_OVERRIDE: does not override + * @GI_VFUNC_THROWS: Includes a #GError * * Flags of a #GIVFuncInfo struct. */ @@ -410,7 +411,8 @@ typedef enum { GI_VFUNC_MUST_CHAIN_UP = 1 << 0, GI_VFUNC_MUST_OVERRIDE = 1 << 1, - GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2 + GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2, + GI_VFUNC_THROWS = 1 << 3 } GIVFuncInfoFlags; /** diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index 332655a0..c55c28d7 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -104,6 +104,9 @@ g_vfunc_info_get_flags (GIVFuncInfo *info) if (blob->must_not_be_implemented) flags = flags | GI_VFUNC_MUST_NOT_OVERRIDE; + if (blob->throws) + flags = flags | GI_VFUNC_THROWS; + return flags; } diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 66a6dad1..8734a903 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3946,6 +3946,17 @@ gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMa return return_value; } +gboolean +gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *self, + gint x, + GError **error) +{ + gulong local = 0x12345678; + gboolean ret = GI_MARSHALLING_TESTS_OBJECT_GET_CLASS (self)->vfunc_meth_with_err (self, x, error); + g_assert_cmpint(local, ==, 0x12345678); + return ret; +} + G_DEFINE_TYPE (GIMarshallingTestsSubObject, gi_marshalling_tests_sub_object, GI_MARSHALLING_TESTS_TYPE_OBJECT); static void @@ -4280,7 +4291,6 @@ gi_marshalling_tests_overrides_object_method (GIMarshallingTestsOverridesObject return 42; } - /** * gi_marshalling_tests_overrides_object_returnv: * diff --git a/tests/gimarshallingtests.h b/tests/gimarshallingtests.h index e4f5cb9b..1d66991f 100644 --- a/tests/gimarshallingtests.h +++ b/tests/gimarshallingtests.h @@ -737,6 +737,12 @@ struct _GIMarshallingTestsObjectClass */ glong (* vfunc_return_value_and_multiple_out_parameters) (GIMarshallingTestsObject *self, glong *a, glong *b); + /** + * GIMarshallingTestsObjectClass::vfunc_meth_with_err: + * @x: + * @error: A #GError + */ + gboolean (*vfunc_meth_with_err) (GIMarshallingTestsObject *object, gint x, GError **error); }; struct _GIMarshallingTestsObject @@ -766,6 +772,7 @@ void gi_marshalling_tests_object_vfunc_one_out_parameter (GIMarshallingTestsObje void gi_marshalling_tests_object_vfunc_multiple_out_parameters (GIMarshallingTestsObject *self, gfloat *a, gfloat *b); glong gi_marshalling_tests_object_vfunc_return_value_and_one_out_parameter (GIMarshallingTestsObject *self, glong *a); glong gi_marshalling_tests_object_vfunc_return_value_and_multiple_out_parameters (GIMarshallingTestsObject *self, glong *a, glong *b); +gboolean gi_marshalling_tests_object_vfunc_meth_with_error (GIMarshallingTestsObject *object, gint x, GError **error); GIMarshallingTestsObject *gi_marshalling_tests_object_none_return (void); GIMarshallingTestsObject *gi_marshalling_tests_object_full_return (void); |