Skip to content

Commit

Permalink
Fix documenting of custom agent type.
Browse files Browse the repository at this point in the history
Using `define_agent`, if an agent is defined
in `__module`, we also point `Core.@__doc__` to
document the type inside that module.
  • Loading branch information
thevolatilebit committed Feb 22, 2024
1 parent dccb8fb commit b14b129
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AlgebraicAgents"
uuid = "f6eb0ae3-10fa-40e6-88dd-9006ba45093a"
version = "0.3.22"
version = "0.3.23"

[deps]
Crayons = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
Expand Down
5 changes: 3 additions & 2 deletions src/agents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ function define_agent(base_type, super_type, type, __module, constructor)
$$(QuoteNode(constructor))
end
end

# it is important to evaluate the macro in the module of the toplevel eval
Base.eval($__module, expr)
end

Core.@__doc__($(esc(Docs.namify(new_name))))
Core.@__doc__($__module.$(Docs.namify(new_name)))
nothing
end
end
Expand Down Expand Up @@ -125,7 +126,7 @@ function aagent(base_type, super_type, type, __module)
function $(tname)(name::AbstractString,
args...) where {
$(param_tnames_constraints...),
}
}
uuid = AlgebraicAgents.uuid4()
inners = Dict{String, AbstractAlgebraicAgent}()
relpathrefs = Dict{AbstractString,
Expand Down

0 comments on commit b14b129

Please sign in to comment.