ruby-changes:49053
From: yui-knk <ko1@a...>
Date: Tue, 12 Dec 2017 23:10:28 +0900 (JST)
Subject: [ruby-changes:49053] yui-knk:r61168 (trunk): parse.y: Set locations of nd_body in NODE_ITER explicitly
yui-knk 2017-12-12 23:10:23 +0900 (Tue, 12 Dec 2017) New Revision: 61168 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61168 Log: 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. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61167) +++ parse.y (revision 61168) @@ -3648,6 +3648,8 @@ do_block : keyword_do_block https://github.com/ruby/ruby/blob/trunk/parse.y#L3648 { $$ = $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 : '{' https://github.com/ruby/ruby/blob/trunk/parse.y#L3818 { $$ = $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); /*% %*/ } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/