Project

General

Profile

Bug #13196 ยป missing_kwargs.diff

Updated Patch - olivierlacan (Olivier Lacan), 03/16/2017 08:09 AM

View differences:

vm_args.c
725 725
static void
726 726
argument_arity_error(rb_thread_t *th, const rb_iseq_t *iseq, const int miss_argc, const int min_argc, const int max_argc)
727 727
{
728
    raise_argument_error(th, iseq, rb_arity_error_new(miss_argc, min_argc, max_argc));
728
    VALUE exc = rb_arity_error_new(miss_argc, min_argc, max_argc);
729
    if (iseq->body->param.flags.has_kw) {
730
   const struct rb_iseq_param_keyword *const kw = iseq->body->param.keyword;
731
   const ID *keywords = kw->table;
732
   int req_key_num = kw->required_num;
733
   if (req_key_num > 0) {
734
       VALUE mesg = rb_attr_get(exc, idMesg);
735
       rb_str_resize(mesg, RSTRING_LEN(mesg)-1);
736
       rb_str_cat_cstr(mesg, "; required keyword");
737
       if (req_key_num > 1) rb_str_cat_cstr(mesg, "s");
738
       rb_str_cat_cstr(mesg, ":");
739
       do {
740
       rb_str_cat_cstr(mesg, " ");
741
       rb_str_append(mesg, rb_id2str(*keywords++));
742
       rb_str_cat_cstr(mesg, ",");
743
       } while (--req_key_num);
744
       RSTRING_PTR(mesg)[RSTRING_LEN(mesg)-1] = ')';
745
   }
746
    }
747
    raise_argument_error(th, iseq, exc);
729 748
}
730 749

  
731 750
static void