From 28d00c2fb2949c67f9510d61c41ad58047c4ab01 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Sat, 18 Nov 2017 01:40:13 +0000 Subject: Update the last location of NODE_ARRAY * parse.y (list_append_gen, list_concat): Update the last location of NODE_ARRAY when an item is appended or concatenated with another NODE_ARRAY. e.g. The locations of NODE_ARRAY is fixed: ``` a(1,2,3) ``` * Before ``` NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 3) ``` * After ``` NODE_ARRAY (line: 1, first_lineno: 1, first_column: 2, last_lineno: 1, last_column: 7) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 2dbb2865f0..936d7ab841 100644 --- a/parse.y +++ b/parse.y @@ -9032,6 +9032,10 @@ list_append_gen(struct parser_params *parser, NODE *list, NODE *item, const YYLT list->nd_alen += 1; last->nd_next = new_list(item, location); list->nd_next->nd_end = last->nd_next; + + nd_set_last_lineno(list, nd_last_lineno(item)); + nd_set_last_column(list, nd_last_column(item)); + return list; } @@ -9057,6 +9061,9 @@ list_concat(NODE *head, NODE *tail) head->nd_next->nd_end = tail; } + nd_set_last_lineno(head, nd_last_lineno(tail)); + nd_set_last_column(head, nd_last_column(tail)); + return head; } -- cgit v1.2.3