summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-07 02:25:37 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-07 02:25:37 +0000
commitd2d4839a390434af70c20f36065b7804597a7337 (patch)
tree0224333bf98a050e8aa9a1c24232086f25a1cbe4
parent04594937ebce0f6a03b81d4d2a10480cf4164005 (diff)
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)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--parse.y4
1 files changed, 3 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index c7f90d19fd..3b35350a07 100644
--- a/parse.y
+++ b/parse.y
@@ -9659,15 +9659,17 @@ new_xstring_gen(struct parser_params *parser, NODE *node, const YYLTYPE *locatio
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));