From: Kouhei S. <nu...@co...> - 2017-12-02 02:51:43
|
Kouhei Sutou 2017-12-02 11:50:53 +0900 (Sat, 02 Dec 2017) New Revision: 4e2bb563a89c92cbda9d03a05e867c48ea203cdd https://github.com/ruby-gnome2/ruby-gnome2/commit/4e2bb563a89c92cbda9d03a05e867c48ea203cdd Message: gi: show callable target information on error Modified files: gobject-introspection/ext/gobject-introspection/rb-gi-argument.c gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c Modified: gobject-introspection/ext/gobject-introspection/rb-gi-argument.c (+13 -2) =================================================================== --- gobject-introspection/ext/gobject-introspection/rb-gi-argument.c 2017-12-01 09:36:36 +0900 (b6900d5ee) +++ gobject-introspection/ext/gobject-introspection/rb-gi-argument.c 2017-12-02 11:50:53 +0900 (a2557b68a) @@ -3406,7 +3406,8 @@ rb_gi_in_argument_transfer(GIArgument *argument, GITransfer transfer, } GIArgument * -rb_gi_in_argument_from_ruby(GIArgument *argument, +rb_gi_in_argument_from_ruby(GICallableInfo *callable_info, + GIArgument *argument, GIArgInfo *arg_info, guint nth_rb_argument, VALUE rb_argument, @@ -3419,7 +3420,12 @@ rb_gi_in_argument_from_ruby(GIArgument *argument, memset(argument, 0, sizeof(GIArgument)); return argument; } else { + const char *module_name; + GIBaseInfo *klass; const char *suffix; + + module_name = g_base_info_get_namespace(callable_info); + klass = g_base_info_get_container(callable_info); if (nth_rb_argument == 1) { suffix = "st"; } else if (nth_rb_argument == 2) { @@ -3430,7 +3436,12 @@ rb_gi_in_argument_from_ruby(GIArgument *argument, suffix = "th"; } rb_raise(rb_eArgError, - "the %u%s argument must not nil: <%s>", + "<%s%s%s%s%s>: the %u%s argument must not nil: <%s>", + module_name, + klass ? "::" : "", + klass ? g_base_info_get_name(klass) : "", + klass ? "#" : ".", + g_base_info_get_name(callable_info), nth_rb_argument, suffix, g_base_info_get_name(arg_info)); Modified: gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h (+2 -1) =================================================================== --- gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h 2017-12-01 09:36:36 +0900 (e1fd95bd3) +++ gobject-introspection/ext/gobject-introspection/rb-gi-conversions.h 2017-12-02 11:50:53 +0900 (b813ae57b) @@ -124,7 +124,8 @@ GIArgument *rb_gi_value_argument_from_ruby (GIArgument *argument, GITypeInfo *type_info, VALUE rb_argument, VALUE self); -GIArgument *rb_gi_in_argument_from_ruby (GIArgument *argument, +GIArgument *rb_gi_in_argument_from_ruby (GICallableInfo *callable_info, + GIArgument *argument, GIArgInfo *arg_info, guint nth_rb_argument, VALUE rb_argument, Modified: gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c (+13 -5) =================================================================== --- gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c 2017-12-01 09:36:36 +0900 (f74a25688) +++ gobject-introspection/ext/gobject-introspection/rb-gi-function-info.c 2017-12-02 11:50:53 +0900 (c3878e89c) @@ -1123,8 +1123,11 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args) } static void -in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments, - GArray *in_args, GPtrArray *args_metadata, +in_argument_from_ruby(GICallableInfo *callable_info, + RBGIArgMetadata *metadata, + VALUE rb_arguments, + GArray *in_args, + GPtrArray *args_metadata, VALUE self) { if (metadata->callback_p && !metadata->destroy_p) { @@ -1172,7 +1175,8 @@ in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments, rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index]; } argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index)); - rb_gi_in_argument_from_ruby(argument, + rb_gi_in_argument_from_ruby(callable_info, + argument, &(metadata->arg_info), metadata->rb_arg_index, rb_argument, @@ -1216,8 +1220,12 @@ arguments_from_ruby(GICallableInfo *info, VALUE self, VALUE rb_arguments, metadata = g_ptr_array_index(args_metadata, i); if (metadata->in_arg_index != -1) { - in_argument_from_ruby(metadata, rb_arguments, - in_args, args_metadata, self); + in_argument_from_ruby(info, + metadata, + rb_arguments, + in_args, + args_metadata, + self); } else { out_argument_from_ruby(metadata, out_args); } |