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)
59
59
stack = [ ISeq . new ( RubyVM ::InstructionSequence . compile ( source ) . to_a ) ]
60
60
61
61
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
63
77
iseq . each_child { |child | stack << child }
64
78
end
65
79
You can’t perform that action at this time.
0 commit comments