@@ -275,6 +275,7 @@ def index_iseq(iseq, file_comments)
275275 queue = [ [ iseq , [ ] ] ]
276276
277277 while ( current_iseq , current_nesting = queue . shift )
278+ file = current_iseq [ 5 ]
278279 line = current_iseq [ 8 ]
279280 insns = current_iseq [ 13 ]
280281
@@ -309,7 +310,7 @@ def index_iseq(iseq, file_comments)
309310 find_constant_path ( insns , index - 1 )
310311
311312 if superclass . empty?
312- warn ( "superclass with non constant path on line #{ line } " )
313+ warn ( "#{ file } : #{ line } : superclass with non constant path" )
313314 next
314315 end
315316 end
@@ -328,7 +329,9 @@ def index_iseq(iseq, file_comments)
328329 # defined on self. We could, but it would require more
329330 # emulation.
330331 if insns [ index - 2 ] != [ :putself ]
331- warn ( "singleton class with non-self receiver" )
332+ warn (
333+ "#{ file } :#{ line } : singleton class with non-self receiver"
334+ )
332335 next
333336 end
334337 elsif flags & VM_DEFINECLASS_TYPE_MODULE > 0
@@ -361,7 +364,7 @@ def index_iseq(iseq, file_comments)
361364 )
362365 when :definesmethod
363366 if insns [ index - 1 ] != [ :putself ]
364- warn ( "singleton method with non-self receiver" )
367+ warn ( "#{ file } : #{ line } : singleton method with non-self receiver" )
365368 next
366369 end
367370
@@ -389,15 +392,15 @@ def index_iseq(iseq, file_comments)
389392 when :opt_send_without_block , :send
390393 case insn [ 1 ] [ :mid ]
391394 when :attr_reader , :attr_writer , :attr_accessor
392- names = find_attr_arguments ( insns , index )
393- next unless names
395+ attr_names = find_attr_arguments ( insns , index )
396+ next unless attr_names
394397
395398 location = Location . new ( line , :unknown )
396- names . each do |name |
399+ attr_names . each do |attr_name |
397400 if insn [ 1 ] [ :mid ] != :attr_writer
398401 results << method_definition (
399402 current_nesting ,
400- name ,
403+ attr_name ,
401404 location ,
402405 file_comments
403406 )
@@ -406,7 +409,7 @@ def index_iseq(iseq, file_comments)
406409 if insn [ 1 ] [ :mid ] != :attr_reader
407410 results << method_definition (
408411 current_nesting ,
409- :"#{ name } =" ,
412+ :"#{ attr_name } =" ,
410413 location ,
411414 file_comments
412415 )
@@ -417,8 +420,8 @@ def index_iseq(iseq, file_comments)
417420 # non-interpolated value. To do this we'll match the specific
418421 # pattern we're expecting.
419422 values =
420- insns [ ( index - 4 ) ...index ] . map do |insn |
421- insn . is_a? ( Array ) ? insn [ 0 ] : insn
423+ insns [ ( index - 4 ) ...index ] . map do |previous |
424+ previous . is_a? ( Array ) ? previous [ 0 ] : previous
422425 end
423426 if values !=
424427 %i[ putspecialobject putspecialobject putobject putobject ]
0 commit comments