Need to adjust the stack length of the top-level environment; fix #3819

This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-10-16 22:35:25 +09:00
parent c3710dbb96
commit 1988bec23e
+7
View File
@@ -544,6 +544,13 @@ done:
if (args.verbose) {
mrb_codedump_all(mrb, proc);
}
/* adjest stack length of toplevel environment */
if (mrb->c->cibase->env) {
struct REnv *e = mrb->c->cibase->env;
if (MRB_ENV_STACK_LEN(e) < proc->body.irep->nlocals) {
MRB_SET_ENV_STACK_LEN(e, proc->body.irep->nlocals);
}
}
/* pass a proc for evaluation */
/* evaluate the bytecode */
result = mrb_vm_run(mrb,