extracting from stack in 2 steps to leave stack intact in case of error

This commit is contained in:
Gwenhael Le Moine 2022-02-10 14:57:14 +01:00
parent b8724a4a1c
commit e9e44f7d69
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -155,7 +155,8 @@ class Interpreter
args = []
needs.each do |need|
raise ArgumentError, "Type Error, needed #{need} got #{elt[:type]}" unless need == :any || need.include?( @stack.last[:type] )
end
needs.each do # rubocop:disable Style/CombinableLoops
args << @stack.pop
end