зеркало из https://github.com/github/ruby.git
ast.c: use enum in switch for warnings
* ext/-test-/ast/ast.c (node_children): use enum instead of int for not-handled enumeration value in switch warnings. * ext/-test-/ast/ast.c (node_children): fix the rb_bug message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
496ddbc275
Коммит
41f4ac6aa2
|
@ -179,7 +179,8 @@ dump_array(rb_ast_t *ast, NODE *node)
|
|||
static VALUE
|
||||
node_children(rb_ast_t *ast, NODE *node)
|
||||
{
|
||||
switch (nd_type(node)) {
|
||||
enum node_type type = nd_type(node);
|
||||
switch (type) {
|
||||
case NODE_BLOCK:
|
||||
return dump_block(ast, node);
|
||||
case NODE_IF:
|
||||
|
@ -227,7 +228,6 @@ node_children(rb_ast_t *ast, NODE *node)
|
|||
andor:
|
||||
{
|
||||
VALUE ary = rb_ary_new();
|
||||
enum node_type type = nd_type(node);
|
||||
|
||||
while (1) {
|
||||
rb_ary_push(ary, NEW_CHILD(ast, node->nd_1st));
|
||||
|
@ -417,7 +417,7 @@ node_children(rb_ast_t *ast, NODE *node)
|
|||
break;
|
||||
}
|
||||
|
||||
rb_bug("dump_node: unknown node: %s", ruby_node_name(nd_type(node)));
|
||||
rb_bug("node_children: unknown node: %s", ruby_node_name(type));
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче