diff options
author | Colin Walters <walters@verbum.org> | 2012-02-03 13:20:00 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2012-02-03 13:20:57 -0500 |
commit | 39a70b7b108ed1a262de0b9dc3ffca944d9eee0f (patch) | |
tree | a3ef3ed0fdd5893f4672aceed9c267193919f534 /girepository | |
parent | 79dcd9cd97b36b92a8f0dd0b94f40055fddbf7d4 (diff) | |
download | gobject-introspection-39a70b7b108ed1a262de0b9dc3ffca944d9eee0f.tar.gz |
girepository: Add GI_VFUNC_THROWS
Virtual functions can definitely throw an error. Right now the
scanner omits the GError parameter for them and adds throws="1", but
g-ir-compiler ignores this.
https://bugzilla.gnome.org/show_bug.cgi?id=669332
Diffstat (limited to 'girepository')
-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 |
7 files changed, 20 insertions, 2 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; } |