Skip to content

Commit 906cb66

Browse files
committed
Fix docs and add doctest
1 parent b393c54 commit 906cb66

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/src/internals.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ Libtask.is_produce_stmt
66
Libtask.might_produce
77
Libtask.stmt_might_produce
88
Libtask.LazyCallable
9+
Libtask.inc_args
910
```

src/copyable_task.jl

+7-3
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,14 @@ end
288288
@inline Base.getindex(x::ProducedValue) = x.x
289289

290290
"""
291-
inc_args(stmt)
291+
inc_args(stmt::T)::T where {T}
292292
293-
Increment by `1` the `n` field of any `Argument`s present in `stmt`.
294-
Used in `make_ad_stmts!`.
293+
Returns a new `T` which is equal to `stmt`, except any `Argument`s present in `stmt` are
294+
incremented by `1`. For example
295+
```jldoctest
296+
julia> Libtask.inc_args(Core.ReturnNode(Core.Argument(1)))
297+
:(return _2)
298+
```
295299
"""
296300
inc_args(x::Expr) = Expr(x.head, map(__inc, x.args)...)
297301
inc_args(x::ReturnNode) = isdefined(x, :val) ? ReturnNode(__inc(x.val)) : x

0 commit comments

Comments
 (0)