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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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:
Expand Down

0 comments on commit dc56bbe

Please sign in to comment.