Skip to content

Commit 28d00c2

Browse files
committed
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
1 parent 19f7001 commit 28d00c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

parse.y

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9032,6 +9032,10 @@ list_append_gen(struct parser_params *parser, NODE *list, NODE *item, const YYLT
90329032
list->nd_alen += 1;
90339033
last->nd_next = new_list(item, location);
90349034
list->nd_next->nd_end = last->nd_next;
9035+
9036+
nd_set_last_lineno(list, nd_last_lineno(item));
9037+
nd_set_last_column(list, nd_last_column(item));
9038+
90359039
return list;
90369040
}
90379041

@@ -9057,6 +9061,9 @@ list_concat(NODE *head, NODE *tail)
90579061
head->nd_next->nd_end = tail;
90589062
}
90599063

9064+
nd_set_last_lineno(head, nd_last_lineno(tail));
9065+
nd_set_last_column(head, nd_last_column(tail));
9066+
90609067
return head;
90619068
}
90629069

0 commit comments

Comments
 (0)