error.c: copy keyword arguments
* error.c (rb_key_err_new): pass arguments all arguments to the super method, except for keyword arguments copied to instance variables. [Feature #14313] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ba4aba0d6c
commit
98c88786c7
24
error.c
24
error.c
@ -1690,29 +1690,21 @@ rb_key_err_new(VALUE mesg, VALUE recv, VALUE key)
|
|||||||
static VALUE
|
static VALUE
|
||||||
key_err_initialize(int argc, VALUE *argv, VALUE self)
|
key_err_initialize(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
VALUE message;
|
|
||||||
VALUE options;
|
VALUE options;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "01:", &message, &options);
|
rb_call_super(rb_scan_args(argc, argv, "01:", NULL, &options), argv);
|
||||||
|
|
||||||
if (NIL_P(message)) {
|
|
||||||
rb_call_super(0, NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rb_call_super(1, &message);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!NIL_P(options)) {
|
if (!NIL_P(options)) {
|
||||||
ID keywords[2];
|
ID keywords[2];
|
||||||
VALUE values[2];
|
VALUE values[numberof(keywords)];
|
||||||
|
int i;
|
||||||
keywords[0] = id_receiver;
|
keywords[0] = id_receiver;
|
||||||
keywords[1] = id_key;
|
keywords[1] = id_key;
|
||||||
rb_get_kwargs(options, keywords, 0, 2, values);
|
rb_get_kwargs(options, keywords, 0, numberof(values), values);
|
||||||
if (values[0] != Qundef) {
|
for (i = 0; i < numberof(values); ++i) {
|
||||||
rb_ivar_set(self, id_receiver, values[0]);
|
if (values[i] != Qundef) {
|
||||||
}
|
rb_ivar_set(self, keywords[i], values[i]);
|
||||||
if (values[1] != Qundef) {
|
}
|
||||||
rb_ivar_set(self, id_key, values[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user