зеркало из https://github.com/github/ruby.git
Differentiate `NODE_BREAK`/`NODE_NEXT`/`NODE_RETURN`
This commit is contained in:
Родитель
f5f3b35b93
Коммит
696022a0cb
6
ast.c
6
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:
|
||||
|
|
11
node_dump.c
11
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:
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче