зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
19f70016d4
Коммит
28d00c2fb2
7
parse.y
7
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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче