summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-08 12:23:53 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-08 12:23:53 +0000
commitfe1575faa4c99ede31dce9f5975ce264d189a6fa (patch)
tree59acb7e07b9f9606bcdd2c5e8923d08746cd81fc /parse.y
parenta7d49457dfd23dba835e4380b8e3381861f3a671 (diff)
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
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 55a7dafe73..0dc885e34d 100644
--- a/parse.y
+++ b/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");
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;