ruby-changes:64883
From: Nobuyoshi <ko1@a...>
Date: Thu, 14 Jan 2021 16:59:47 +0900 (JST)
Subject: [ruby-changes:64883] bb40c5cbe9 (master): Ensure symbol list node is either NODE_STR or NODE_DSTR
https://git.ruby-lang.org/ruby.git/commit/?id=bb40c5cbe9 From bb40c5cbe977de9f36a2a739e94e9b2fd4496b6e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 14 Jan 2021 16:13:26 +0900 Subject: Ensure symbol list node is either NODE_STR or NODE_DSTR diff --git a/parse.y b/parse.y index 538153c..29784f3 100644 --- a/parse.y +++ b/parse.y @@ -10362,12 +10362,17 @@ new_defined(struct parser_params *p, NODE *expr, const YYLTYPE *loc) https://github.com/ruby/ruby/blob/trunk/parse.y#L10362 static NODE* symbol_append(struct parser_params *p, NODE *symbols, NODE *symbol) { - if (nd_type(symbol) == NODE_DSTR) { + enum node_type type = nd_type(symbol); + switch (type) { + case NODE_DSTR: nd_set_type(symbol, NODE_DSYM); - } - else { + break; + case NODE_STR: nd_set_type(symbol, NODE_LIT); RB_OBJ_WRITTEN(p->ast, Qnil, symbol->nd_lit = rb_str_intern(symbol->nd_lit)); + break; + default: + compile_error(p, "unexpected node as symbol: %s", ruby_node_name(type)); } return list_append(p, symbols, symbol); } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/