Skip to content
Permalink
Browse files

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
  • Loading branch information...
nobu committed May 1, 2018
1 parent 496ddbc commit 41f4ac6aa21588722a6323dbbc34274b7e9aec49
Showing with 3 additions and 3 deletions.
  1. +3 −3 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

0 comments on commit 41f4ac6

Please sign in to comment.
You can’t perform that action at this time.