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:
parent
a7d49457df
commit
fe1575faa4
4
parse.y
4
parse.y
@ -8852,7 +8852,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail, const YYL
|
|||||||
parser_warning(h, "unused literal ignored");
|
parser_warning(h, "unused literal ignored");
|
||||||
return tail;
|
return tail;
|
||||||
default:
|
default:
|
||||||
h = end = NEW_BLOCK(head, location);
|
h = end = NEW_BLOCK(head, &head->nd_loc);
|
||||||
end->nd_end = end;
|
end->nd_end = end;
|
||||||
head = end;
|
head = end;
|
||||||
break;
|
break;
|
||||||
@ -8878,7 +8878,7 @@ block_append_gen(struct parser_params *parser, NODE *head, NODE *tail, const YYL
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nd_type(tail) != NODE_BLOCK) {
|
if (nd_type(tail) != NODE_BLOCK) {
|
||||||
tail = NEW_BLOCK(tail, location);
|
tail = NEW_BLOCK(tail, &tail->nd_loc);
|
||||||
tail->nd_end = tail;
|
tail->nd_end = tail;
|
||||||
}
|
}
|
||||||
end->nd_next = tail;
|
end->nd_next = tail;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user