Skip to content

Commit

Permalink
Ignore empty ensure clause.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 28, 2017
1 parent fb3243e commit dc56bbe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mrbgems/mruby-compiler/core/codegen.c
Expand Up @@ -1360,7 +1360,9 @@ codegen(codegen_scope *s, node *tree, int val)
break; break;


case NODE_ENSURE: case NODE_ENSURE:
{ if (!tree->cdr || !tree->cdr->cdr ||
((intptr_t)tree->cdr->cdr->car == NODE_BEGIN &&
tree->cdr->cdr->cdr)) {
int idx; int idx;
int epush = s->pc; int epush = s->pc;


Expand All @@ -1372,6 +1374,9 @@ codegen(codegen_scope *s, node *tree, int val)
s->ensure_level--; s->ensure_level--;
genop_peep(s, MKOP_A(OP_EPOP, 1), NOVAL); genop_peep(s, MKOP_A(OP_EPOP, 1), NOVAL);
} }
else { /* empty ensure ignored */
codegen(s, tree->car, val);
}
break; break;


case NODE_LAMBDA: case NODE_LAMBDA:
Expand Down

0 comments on commit dc56bbe

Please sign in to comment.