parse.y: Use nd_loc of head and tail

* parse.y (block_append_gen): Use nd_loc of
  head(tail) when create NEW_BLOCK of head(tail).

  e.g. The locations of the NODE_BLOCK is fixed:

  ```
  BEGIN {
    :a
  }

  BEGIN {
    :b
  }
  ```

  * Before

  ```
  NODE_BLOCK (line: 5, code_range: (5,0)-(7,1))
  ```

  * After

  ```
  NODE_BLOCK (line: 1, code_range: (1,0)-(7,1))
  ```

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yui-knk 2018-01-08 12:23:53 +00:00
Родитель a7d49457df
Коммит fe1575faa4
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -8852,7 +8852,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail, const YYL
parser_warning(h, "unused literal ignored");
return tail;
default:
h = end = NEW_BLOCK(head, location);
h = end = NEW_BLOCK(head, &head->nd_loc);
end->nd_end = end;
head = end;
break;
@ -8878,7 +8878,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail, const YYL
}
if (nd_type(tail) != NODE_BLOCK) {
tail = NEW_BLOCK(tail, location);
tail = NEW_BLOCK(tail, &tail->nd_loc);
tail->nd_end = tail;
}
end->nd_next = tail;