summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 14:10:23 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-12 14:10:23 +0000
commit46e8a8ae379bdf0795eb60e8cf22a20457272d02 (patch)
treeaffc2450ad7583d2b4cc7144419d821643c0bfa9 /parse.y
parent89c7e6de442d558b6819cb23b7a011410ea19668 (diff)
parse.y: Set locations of nd_body in NODE_ITER explicitly
* parse.y: Currently the location of do_body is set by new_do_body. Sometimes the last part of do_body is none, because bodystmt ends with opt_ensure. Token keyword_end has been looked ahead when a tokenizer generates none, so the last location of opt_ensure matches the last location of `end`. But this relation will be broken when we change the last location of none to be equal to the first location of none. So set locations of nd_body in NODE_ITER explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 1026d5c896..7d0f96de41 100644
--- a/parse.y
+++ b/parse.y
@@ -3648,6 +3648,8 @@ do_block : keyword_do_block
{
$$ = $3;
/*%%%*/
+ $3->nd_body->nd_loc.first_loc = @1.first_loc;
+ $3->nd_body->nd_loc.last_loc = @4.last_loc;
nd_set_line($$, $<num>2);
/*% %*/
}
@@ -3816,6 +3818,8 @@ brace_block : '{'
{
$$ = $3;
/*%%%*/
+ $3->nd_body->nd_loc.first_loc = @1.first_loc;
+ $3->nd_body->nd_loc.last_loc = @4.last_loc;
nd_set_line($$, $<num>2);
/*% %*/
}