diff options
author | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-18 01:40:13 +0000 |
---|---|---|
committer | yui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-11-18 01:40:13 +0000 |
commit | 28d00c2fb2949c67f9510d61c41ad58047c4ab01 (patch) | |
tree | a14021157fa904231801822e6825d53fb5ccef2a | |
parent | 19f70016d4f1688e09bd0b460d308432118819a0 (diff) | |
download | ruby-28d00c2fb2949c67f9510d61c41ad58047c4ab01.tar.gz |
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
-rw-r--r-- | parse.y | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; } |