ruby-changes:48987
From: yui-knk <ko1@a...>
Date: Mon, 11 Dec 2017 11:19:48 +0900 (JST)
Subject: [ruby-changes:48987] yui-knk:r61106 (trunk): parse.y: Fix locations of NODE_DSTR generated by evstr2dstr_gen
yui-knk 2017-12-11 11:19:43 +0900 (Mon, 11 Dec 2017) New Revision: 61106 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61106 Log: parse.y: Fix locations of NODE_DSTR generated by evstr2dstr_gen * parse.y (evstr2dstr_gen): Fix to only include a range of node. e.g. The locations of the NODE_DSTR is fixed: ``` %W[a #{b} c] ``` * Before ``` NODE_DSTR (line: 1, code_range: (1,3)-(1,9)) ``` * After ``` NODE_DSTR (line: 1, code_range: (1,5)-(1,9)) ``` Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61105) +++ parse.y (revision 61106) @@ -433,8 +433,8 @@ static NODE *literal_concat_gen(struct p https://github.com/ruby/ruby/blob/trunk/parse.y#L433 static int literal_concat0(struct parser_params *, VALUE, VALUE); static NODE *new_evstr_gen(struct parser_params*,NODE*,const YYLTYPE*); #define new_evstr(n, location) new_evstr_gen(parser,(n),(location)) -static NODE *evstr2dstr_gen(struct parser_params*,NODE*,const YYLTYPE*); -#define evstr2dstr(n,location) evstr2dstr_gen(parser,(n),(location)) +static NODE *evstr2dstr_gen(struct parser_params*,NODE*); +#define evstr2dstr(n) evstr2dstr_gen(parser,(n)) static NODE *splat_array(NODE*); static NODE *call_bin_op_gen(struct parser_params*,NODE*,ID,NODE*,const YYLTYPE*,const YYLTYPE*); @@ -3931,7 +3931,7 @@ strings : string https://github.com/ruby/ruby/blob/trunk/parse.y#L3931 node = new_str(STR_NEW0(), &@$); } else { - node = evstr2dstr(node, &@$); + node = evstr2dstr(node); } $$ = node; /*% @@ -4001,7 +4001,7 @@ word_list : /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L4001 | word_list word ' ' { /*%%%*/ - $$ = list_append($1, evstr2dstr($2, &@$)); + $$ = list_append($1, evstr2dstr($2)); /*% $$ = dispatch2(words_add, $1, $2); %*/ @@ -4047,7 +4047,7 @@ symbol_list : /* none */ https://github.com/ruby/ruby/blob/trunk/parse.y#L4047 | symbol_list word ' ' { /*%%%*/ - $2 = evstr2dstr($2, &@$); + $2 = evstr2dstr($2); if (nd_type($2) == NODE_DSTR) { nd_set_type($2, NODE_DSYM); } @@ -9200,10 +9200,10 @@ literal_concat_gen(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L9200 } static NODE * -evstr2dstr_gen(struct parser_params *parser, NODE *node, const YYLTYPE *location) +evstr2dstr_gen(struct parser_params *parser, NODE *node) { if (nd_type(node) == NODE_EVSTR) { - node = list_append(new_dstr(STR_NEW0(), location), node); + node = list_append(new_dstr(STR_NEW0(), &node->nd_loc), node); } return node; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/