Need to adjust the stack length of the top-level environment; fix
@@ -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,
