Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/tapedtask.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,20 @@ function Base.copy(t::TapedTask; args=())
error("can't copy started task with new arguments")
tf = copy(t.tf)
task_args = if length(args) > 0
# this cond implies t.tf.counter == 0, i.e., the task is not started yet
typeof(args) == typeof(t.args) || error("bad arguments")
args
else
tape_copy.(t.args)
if t.tf.counter > 1
# the task is running, we find the
# real args from the copied bindings
map(1:length(t.args)) do i
get(tf.bindings, Symbol("_", i + 1), t.args[i])
end
else
# the task is not started yet, but no args is given
tape_copy.(t.args)
end
end
new_t = TapedTask(tf, task_args...)
storage = t.task.storage::IdDict{Any,Any}
Expand Down