diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-01 06:55:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-01 06:55:43 +0000 |
commit | 41f4ac6aa21588722a6323dbbc34274b7e9aec49 (patch) | |
tree | d0f2b8c8132210468b682d36406470299bb352f3 /ext/-test- | |
parent | 496ddbc275049fbfe2ab1e320903dab0beec0fd3 (diff) | |
download | ruby-41f4ac6aa21588722a6323dbbc34274b7e9aec49.tar.gz |
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
Diffstat (limited to 'ext/-test-')
-rw-r--r-- | ext/-test-/ast/ast.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/-test-/ast/ast.c b/ext/-test-/ast/ast.c index b5be606499..f608af911e 100644 --- a/ext/-test-/ast/ast.c +++ b/ext/-test-/ast/ast.c @@ -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 |