@@ -641,8 +641,7 @@ def visit(node)
641
641
end
642
642
643
643
def visit_var_ref ( node )
644
- pins . shift
645
- node . pin ( stack [ -2 ] )
644
+ node . pin ( stack [ -2 ] , pins . shift )
646
645
end
647
646
648
647
def self . visit ( node , tokens )
@@ -1683,6 +1682,22 @@ def on_float(value)
1683
1682
# VarField right
1684
1683
# ) -> FndPtn
1685
1684
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
+
1686
1701
# The opening of this find pattern is either going to be a left bracket, a
1687
1702
# right left parenthesis, or the left splat. We're going to use this to
1688
1703
# determine how to find the closing of the pattern, as well as determining
@@ -1791,7 +1806,7 @@ def on_heredoc_beg(value)
1791
1806
line : lineno ,
1792
1807
char : char_pos ,
1793
1808
column : current_column ,
1794
- size : value . size + 1
1809
+ size : value . size
1795
1810
)
1796
1811
1797
1812
# Here we're going to artificially create an extra node type so that if
@@ -1826,7 +1841,7 @@ def on_heredoc_end(value)
1826
1841
line : lineno ,
1827
1842
char : char_pos ,
1828
1843
column : current_column ,
1829
- size : value . size + 1
1844
+ size : value . size
1830
1845
)
1831
1846
1832
1847
heredoc_end = HeredocEnd . new ( value : value . chomp , location : location )
@@ -1841,9 +1856,9 @@ def on_heredoc_end(value)
1841
1856
start_line : heredoc . location . start_line ,
1842
1857
start_char : heredoc . location . start_char ,
1843
1858
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
1847
1862
)
1848
1863
)
1849
1864
end
@@ -2357,14 +2372,14 @@ def on_method_add_arg(call, arguments)
2357
2372
2358
2373
# :call-seq:
2359
2374
# on_method_add_block: (
2360
- # (Break | Call | Command | CommandCall) call,
2375
+ # (Break | Call | Command | CommandCall, Next ) call,
2361
2376
# Block block
2362
2377
# ) -> Break | MethodAddBlock
2363
2378
def on_method_add_block ( call , block )
2364
2379
location = call . location . to ( block . location )
2365
2380
2366
2381
case call
2367
- when Break
2382
+ when Break , Next
2368
2383
parts = call . arguments . parts
2369
2384
2370
2385
node = parts . pop
0 commit comments