ruby-changes:48944
From: yui-knk <ko1@a...>
Date: Thu, 7 Dec 2017 11:25:44 +0900 (JST)
Subject: [ruby-changes:48944] yui-knk:r61063 (trunk): parse.y: Fix locations of xstring
yui-knk 2017-12-07 11:25:37 +0900 (Thu, 07 Dec 2017) New Revision: 61063 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61063 Log: parse.y: Fix locations of xstring * parse.y (new_xstring_gen): Always set locations to include locations of tXSTRING_BEG and tSTRING_END. e.g. The locations of the NODE_XSTR is fixed: ``` `a` ``` * Before ``` NODE_XSTR (line: 1, code_range: (1,1)-(1,2)) ``` * After ``` NODE_XSTR (line: 1, code_range: (1,0)-(1,3)) ``` Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61062) +++ parse.y (revision 61063) @@ -9659,15 +9659,17 @@ new_xstring_gen(struct parser_params *pa https://github.com/ruby/ruby/blob/trunk/parse.y#L9659 VALUE lit = STR_NEW0(); NODE *xstr = NEW_XSTR(lit); add_mark_object(lit); - xstr->nd_loc = * location; + xstr->nd_loc = *location; return xstr; } switch (nd_type(node)) { case NODE_STR: nd_set_type(node, NODE_XSTR); + nd_set_loc(node, location); break; case NODE_DSTR: nd_set_type(node, NODE_DXSTR); + nd_set_loc(node, location); break; default: node = NEW_NODE(NODE_DXSTR, Qnil, 1, new_list(node, location)); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/