diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 7419f01f3..4567ba679 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -7962,12 +7962,16 @@ dump_node(mrb_state *mrb, node *tree, int offset) case NODE_ENSURE: printf("NODE_ENSURE:\n"); - dump_prefix(offset+1, lineno); - printf("body:\n"); - dump_node(mrb, tree->car, offset+2); - dump_prefix(offset+1, lineno); - printf("ensure:\n"); - dump_node(mrb, tree->cdr->cdr, offset+2); + if (ENSURE_NODE_BODY(tree)) { + dump_prefix(offset+1, lineno); + printf("body:\n"); + dump_node(mrb, ENSURE_NODE_BODY(tree), offset+2); + } + if (ENSURE_NODE_ENSURE_CLAUSE(tree)) { + dump_prefix(offset+1, lineno); + printf("ensure:\n"); + dump_node(mrb, ENSURE_NODE_ENSURE_CLAUSE(tree), offset+2); + } break; case NODE_LAMBDA: diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c index 4a034b016..96421696e 100644 --- a/mrbgems/mruby-compiler/core/y.tab.c +++ b/mrbgems/mruby-compiler/core/y.tab.c @@ -14791,12 +14791,16 @@ dump_node(mrb_state *mrb, node *tree, int offset) case NODE_ENSURE: printf("NODE_ENSURE:\n"); - dump_prefix(offset+1, lineno); - printf("body:\n"); - dump_node(mrb, tree->car, offset+2); - dump_prefix(offset+1, lineno); - printf("ensure:\n"); - dump_node(mrb, tree->cdr->cdr, offset+2); + if (ENSURE_NODE_BODY(tree)) { + dump_prefix(offset+1, lineno); + printf("body:\n"); + dump_node(mrb, ENSURE_NODE_BODY(tree), offset+2); + } + if (ENSURE_NODE_ENSURE_CLAUSE(tree)) { + dump_prefix(offset+1, lineno); + printf("ensure:\n"); + dump_node(mrb, ENSURE_NODE_ENSURE_CLAUSE(tree), offset+2); + } break; case NODE_LAMBDA: