14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/torc.rb', line 14
def recur(*args)
name = binding.of_caller(1).eval('__method__')
if _torc_state[:loop_stack].last == name
_torc_state[:finished] = false
return args
else
_torc_state[:loop_stack].push name
begin
begin
_torc_state[:finished] = true
args = __send__ name, *args
if _torc_state[:swap_to]
name, args = _torc_state[:swap_to]
_torc_state[:swap_to] = nil
end
end until _torc_state[:finished]
return args
ensure
_torc_state[:loop_stack].pop
end
end
end
|