From 4cd217937f34829a6ded35a61b9aab0591f642cb Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Wed, 26 Mar 2014 16:40:12 +0900 Subject: [PATCH] if rest argument value is captured, copy it to capture area. close #78. --- src/codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codegen.c b/src/codegen.c index 63f23e49..9c662329 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -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(®s, *var), size_t)) <= cxt->args.size) { + if ((n = xh_val(xh_get(®s, *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;