diff --git a/ast.c b/ast.c index 7090a889ec..622547965f 100644 --- a/ast.c +++ b/ast.c @@ -416,9 +416,11 @@ node_children(rb_ast_t *ast, const NODE *node) case NODE_FOR_MASGN: return rb_ary_new_from_node_args(ast, 1, RNODE_FOR_MASGN(node)->nd_var); case NODE_BREAK: - case NODE_NEXT: - case NODE_RETURN: return rb_ary_new_from_node_args(ast, 1, RNODE_BREAK(node)->nd_stts); + case NODE_NEXT: + return rb_ary_new_from_node_args(ast, 1, RNODE_NEXT(node)->nd_stts); + case NODE_RETURN: + return rb_ary_new_from_node_args(ast, 1, RNODE_RETURN(node)->nd_stts); case NODE_REDO: return rb_ary_new_from_node_args(ast, 0); case NODE_RETRY: diff --git a/node_dump.c b/node_dump.c index d6ccfa84ac..e9e5c950c7 100644 --- a/node_dump.c +++ b/node_dump.c @@ -294,19 +294,22 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node) ANN("break statement"); ANN("format: break [nd_stts]"); ANN("example: break 1"); - goto jump; + LAST_NODE; + F_NODE(nd_stts, RNODE_BREAK, "value"); + return; case NODE_NEXT: ANN("next statement"); ANN("format: next [nd_stts]"); ANN("example: next 1"); - goto jump; + LAST_NODE; + F_NODE(nd_stts, RNODE_NEXT, "value"); + return; case NODE_RETURN: ANN("return statement"); ANN("format: return [nd_stts]"); ANN("example: return 1"); - jump: LAST_NODE; - F_NODE(nd_stts, RNODE_BREAK, "value"); + F_NODE(nd_stts, RNODE_RETURN, "value"); return; case NODE_REDO: diff --git a/rubyparser.h b/rubyparser.h index 4a52ad9ace..b1b3423bdd 100644 --- a/rubyparser.h +++ b/rubyparser.h @@ -281,16 +281,16 @@ typedef struct RNode_FOR_MASGN { typedef struct RNode_BREAK { NODE node; - struct RNode *nd_stts; VALUE not_used; + struct RNode *nd_stts; VALUE not_used2; } rb_node_break_t; typedef struct RNode_NEXT { NODE node; - struct RNode *nd_stts; VALUE not_used; + struct RNode *nd_stts; VALUE not_used2; } rb_node_next_t;