@@ -344,6 +344,7 @@ def spot_call_for_name
344
344
end
345
345
elsif mid . to_s =~ /\A \W +\z / && lines . match ( /\G \s *(#{ Regexp . quote ( mid ) } )=.*\n / , nd_recv . last_column )
346
346
@snippet = $` + $&
347
+ @beg_lineno = @end_lineno = lineno
347
348
@beg_column = $~. begin ( 1 )
348
349
@end_column = $~. end ( 1 )
349
350
end
@@ -582,8 +583,9 @@ def spot_colon2
582
583
@beg_column = nd_parent . last_column
583
584
@end_column = @node . last_column
584
585
else
585
- @snippet = @fetch [ @ node. last_lineno ]
586
+ fetch_line ( @ node. last_lineno )
586
587
if @snippet [ ...@node . last_column ] . match ( /#{ Regexp . quote ( const ) } \z / )
588
+ @beg_lineno = @end_lineno = @node . last_lineno
587
589
@beg_column = $~. begin ( 0 )
588
590
@end_column = $~. end ( 0 )
589
591
end
@@ -597,7 +599,7 @@ def spot_op_cdecl
597
599
nd_lhs , op , _nd_rhs = @node . children
598
600
*nd_parent_lhs , _const = nd_lhs . children
599
601
if @name == op
600
- @snippet = @fetch [ nd_lhs . last_lineno ]
602
+ fetch_line ( nd_lhs . last_lineno )
601
603
if @snippet . match ( /\G \s *(#{ Regexp . quote ( op ) } )=/ , nd_lhs . last_column )
602
604
@beg_column = $~. begin ( 1 )
603
605
@end_column = $~. end ( 1 )
@@ -607,12 +609,12 @@ def spot_op_cdecl
607
609
@end_column = nd_lhs . last_column
608
610
if nd_parent_lhs . empty? # example: ::C += 1
609
611
if nd_lhs . first_lineno == nd_lhs . last_lineno
610
- @snippet = @fetch [ nd_lhs . last_lineno ]
612
+ fetch_line ( nd_lhs . last_lineno )
611
613
@beg_column = nd_lhs . first_column
612
614
end
613
615
else # example: Foo::Bar::C += 1
614
616
if nd_parent_lhs . last . last_lineno == nd_lhs . last_lineno
615
- @snippet = @fetch [ nd_lhs . last_lineno ]
617
+ fetch_line ( nd_lhs . last_lineno )
616
618
@beg_column = nd_parent_lhs . last . last_column
617
619
end
618
620
end
0 commit comments