parse.y: Fix locations of NODE_RESCUE
* parse.y (new_bodystmt): Fix locations of NODE_RESCUE to end with nd_else or nd_resq. Before this commit, locations of NODE_RESCUE included locations of nd_ensr of NODE_ENSURE which is a parent node of NODE_RESCUE. e.g. The location of the end of NODE_RESCUE is fixed: ``` def a :b rescue :c ensure :d end ``` * Before ``` NODE_RESCUE (line: 2, location: (2,2)-(6,4)) ``` * After ``` NODE_RESCUE (line: 3, location: (2,2)-(5,0)) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d89d4e93af
commit
aee5c4338b
6
parse.y
6
parse.y
@ -10263,7 +10263,11 @@ new_bodystmt(struct parser_params *p, NODE *head, NODE *rescue, NODE *rescue_els
|
|||||||
{
|
{
|
||||||
NODE *result = head;
|
NODE *result = head;
|
||||||
if (rescue) {
|
if (rescue) {
|
||||||
result = NEW_RESCUE(head, rescue, rescue_else, loc);
|
NODE *tmp = rescue_else ? rescue_else : rescue;
|
||||||
|
YYLTYPE rescue_loc = code_loc_gen(&head->nd_loc, &tmp->nd_loc);
|
||||||
|
|
||||||
|
result = NEW_RESCUE(head, rescue, rescue_else, &rescue_loc);
|
||||||
|
nd_set_line(result, rescue->nd_loc.beg_pos.lineno);
|
||||||
}
|
}
|
||||||
else if (rescue_else) {
|
else if (rescue_else) {
|
||||||
result = block_append(p, result, rescue_else);
|
result = block_append(p, result, rescue_else);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user