if rest argument value is captured, copy it to capture area. close #78.

This commit is contained in:
Yuichi Nishiwaki 2014-03-26 16:40:12 +09:00
parent 46ac5faa97
commit 4cd217937f
1 changed files with 1 additions and 1 deletions

View File

@ -915,7 +915,7 @@ create_activation(codegen_context *cxt)
for (i = 0; i < cxt->captures.size; ++i) {
var = xv_get(&cxt->captures, i);
if ((n = xh_val(xh_get(&regs, *var), size_t)) <= cxt->args.size) {
if ((n = xh_val(xh_get(&regs, *var), size_t)) <= cxt->args.size || (cxt->varg && n == cxt->args.size + 1)) {
/* copy arguments to capture variable area */
cxt->code[cxt->clen].insn = OP_LREF;
cxt->code[cxt->clen].u.i = n;