Skip to content

Commit 6fdc4f9

Browse files
committed
Fix behaviour of set_retained_vns_del! for num_produce == 0
1 parent e60eab0 commit 6fdc4f9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/varinfo.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,20 +1823,25 @@ end
18231823
"""
18241824
set_retained_vns_del!(vi::VarInfo)
18251825
1826-
Set the `"del"` flag of variables in `vi` with `order > num_produce` to `true`.
1826+
Set the `"del"` flag of variables in `vi` with `order > num_produce` to `true`. If
1827+
`num_produce` is `0`, _all_ variables will have their `"del"` flag set to `true`.
18271828
18281829
Will error if `vi` does not have an accumulator for `VariableOrder`.
18291830
"""
18301831
function set_retained_vns_del!(vi::VarInfo)
18311832
if !hasacc(vi, Val(:VariableOrder))
18321833
msg = "`vi` must have an accumulator for VariableOrder to set the `del` flag."
1833-
raise(ArgumentError(msg))
1834+
throw(ArgumentError(msg))
18341835
end
18351836
num_produce = get_num_produce(vi)
18361837
for vn in keys(vi)
1837-
order = getorder(vi, vn)
1838-
if order > num_produce
1838+
if num_produce == 0
18391839
set_flag!(vi, vn, "del")
1840+
else
1841+
order = getorder(vi, vn)
1842+
if order > num_produce
1843+
set_flag!(vi, vn, "del")
1844+
end
18401845
end
18411846
end
18421847
return nothing

0 commit comments

Comments
 (0)