Ignore empty ensure clause.
MODIFY
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
@@ -1360,7 +1360,9 @@ codegen(codegen_scope *s, node *tree, int val)
break;
case NODE_ENSURE:
- {
+ if (!tree->cdr || !tree->cdr->cdr ||
+ ((intptr_t)tree->cdr->cdr->car == NODE_BEGIN &&
+ tree->cdr->cdr->cdr)) {
int idx;
int epush = s->pc;
@@ -1372,6 +1374,9 @@ codegen(codegen_scope *s, node *tree, int val)
s->ensure_level--;
genop_peep(s, MKOP_A(OP_EPOP, 1), NOVAL);
}
+ else { /* empty ensure ignored */
+ codegen(s, tree->car, val);
+ }
break;
case NODE_LAMBDA:

Ignore empty ensure clause.