@@ -641,8 +641,7 @@ def visit(node)
641641 end
642642
643643 def visit_var_ref ( node )
644- pins . shift
645- node . pin ( stack [ -2 ] )
644+ node . pin ( stack [ -2 ] , pins . shift )
646645 end
647646
648647 def self . visit ( node , tokens )
@@ -1683,6 +1682,22 @@ def on_float(value)
16831682 # VarField right
16841683 # ) -> FndPtn
16851684 def on_fndptn ( constant , left , values , right )
1685+ # The left and right of a find pattern are always going to be splats, so
1686+ # we're going to consume the * operators and use their location
1687+ # information to extend the location of the splats.
1688+ right , left =
1689+ [ right , left ] . map do |node |
1690+ operator = consume_operator ( :* )
1691+ location =
1692+ if node . value
1693+ operator . location . to ( node . location )
1694+ else
1695+ operator . location
1696+ end
1697+
1698+ node . copy ( location : location )
1699+ end
1700+
16861701 # The opening of this find pattern is either going to be a left bracket, a
16871702 # right left parenthesis, or the left splat. We're going to use this to
16881703 # determine how to find the closing of the pattern, as well as determining
@@ -1791,7 +1806,7 @@ def on_heredoc_beg(value)
17911806 line : lineno ,
17921807 char : char_pos ,
17931808 column : current_column ,
1794- size : value . size + 1
1809+ size : value . size
17951810 )
17961811
17971812 # Here we're going to artificially create an extra node type so that if
@@ -1826,7 +1841,7 @@ def on_heredoc_end(value)
18261841 line : lineno ,
18271842 char : char_pos ,
18281843 column : current_column ,
1829- size : value . size + 1
1844+ size : value . size
18301845 )
18311846
18321847 heredoc_end = HeredocEnd . new ( value : value . chomp , location : location )
@@ -1841,9 +1856,9 @@ def on_heredoc_end(value)
18411856 start_line : heredoc . location . start_line ,
18421857 start_char : heredoc . location . start_char ,
18431858 start_column : heredoc . location . start_column ,
1844- end_line : lineno ,
1845- end_char : char_pos ,
1846- end_column : current_column
1859+ end_line : location . end_line ,
1860+ end_char : location . end_char ,
1861+ end_column : location . end_column
18471862 )
18481863 )
18491864 end
@@ -2357,14 +2372,14 @@ def on_method_add_arg(call, arguments)
23572372
23582373 # :call-seq:
23592374 # on_method_add_block: (
2360- # (Break | Call | Command | CommandCall) call,
2375+ # (Break | Call | Command | CommandCall, Next ) call,
23612376 # Block block
23622377 # ) -> Break | MethodAddBlock
23632378 def on_method_add_block ( call , block )
23642379 location = call . location . to ( block . location )
23652380
23662381 case call
2367- when Break
2382+ when Break , Next
23682383 parts = call . arguments . parts
23692384
23702385 node = parts . pop
0 commit comments