Skip to content

Commit

Permalink
Fill omitted arguments by nil for non-strict Proc.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 10, 2017
1 parent c063641 commit 0cb5015
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 0cb5015

Please sign in to comment.