The block argument offset saved in the env was wrong; fix #3768

When the method takes variable number of argument (`argc = -1`),
the block argument offset should be `-1` not `0`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-08-09 12:57:55 +09:00
parent 8f62957888
commit 0a61df1c34
+1
View File
@@ -289,6 +289,7 @@ mrb_env_unshare(mrb_state *mrb, struct REnv *e)
if (!e->c) {
/* save block argument position (negated) */
e->cioff = -e->cxt.c->cibase[cioff].argc-1;
if (e->cioff == 0) e->cioff = -1;
}
e->cxt.mid = e->cxt.c->cibase[cioff].mid;
p = (mrb_value *)mrb_malloc(mrb, sizeof(mrb_value)*len);