File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,21 @@ def self.cruby_locals(source)
5959 stack = [ ISeq . new ( RubyVM ::InstructionSequence . compile ( source ) . to_a ) ]
6060
6161 while ( iseq = stack . pop )
62- locals << iseq . local_table
62+ names = [ *iseq . local_table ]
63+ names . map! . with_index do |name , index |
64+ # When an anonymous local variable is present in the iseq's local
65+ # table, it is represented as the stack offset from the top.
66+ # However, when these are dumped to binary and read back in, they
67+ # are replaced with the symbol :#arg_rest. To consistently handle
68+ # this, we replace them here with their index.
69+ if name == :"#arg_rest"
70+ names . length - index + 1
71+ else
72+ name
73+ end
74+ end
75+
76+ locals << names
6377 iseq . each_child { |child | stack << child }
6478 end
6579
You can’t perform that action at this time.
0 commit comments