Permalink
Browse files

Fill omitted arguments by nil for non-strict Proc.

  • Loading branch information...
matz committed Apr 10, 2017
1 parent c063641 commit 0cb501545cba12fd05ee033eea0c84dbb27e1936
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/vm.c
View
@@ -1607,9 +1607,15 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
if (argv0 != argv) {
value_move(&regs[1], argv, argc-mlen); /* m1 + o */
}
if (argc < m1) {
stack_clear(&regs[argc+1], m1-argc);
}
if (mlen) {
value_move(&regs[len-m2+1], &argv[argc-mlen], mlen);
}
if (mlen < m2) {
stack_clear(&regs[len-m2+mlen+1], m2-mlen);
}
if (r) {
regs[m1+o+1] = mrb_ary_new_capa(mrb, 0);
}

0 comments on commit 0cb5015

Please sign in to comment.