ruby-changes:51106
From: nobu <ko1@a...>
Date: Tue, 1 May 2018 15:55:48 +0900 (JST)
Subject: [ruby-changes:51106] nobu:r63313 (trunk): ast.c: use enum in switch for warnings
nobu 2018-05-01 15:55:43 +0900 (Tue, 01 May 2018) New Revision: 63313 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63313 Log: 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. Modified files: trunk/ext/-test-/ast/ast.c Index: ext/-test-/ast/ast.c =================================================================== --- ext/-test-/ast/ast.c (revision 63312) +++ ext/-test-/ast/ast.c (revision 63313) @@ -179,7 +179,8 @@ dump_array(rb_ast_t *ast, NODE *node) https://github.com/ruby/ruby/blob/trunk/ext/-test-/ast/ast.c#L179 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) https://github.com/ruby/ruby/blob/trunk/ext/-test-/ast/ast.c#L228 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) https://github.com/ruby/ruby/blob/trunk/ext/-test-/ast/ast.c#L417 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/