Skip to content

Commit 38ab597

Browse files
committed
Add "docs" about the callback API
1 parent c94c5fb commit 38ab597

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/CodeTracking.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,23 @@ const method_info = IdDict{Type,Union{Missing,Tuple{LineNumberNode,Expr}}}()
1818

1919
const _pkgfiles = Dict{PkgId,PkgFiles}()
2020

21+
# Callback for method-lookup. `lookupfunc = method_lookup_callback[]` must have the form
22+
# ret = lookupfunc(method)
23+
# where `ret` is either `nothing` or `(lnn, def)`. `lnn` is a LineNumberNode (or any valid
24+
# input to `CodeTracking.fileline`) and `def` is the expression defining the method.
2125
const method_lookup_callback = Ref{Any}(nothing)
22-
const expressions_callback = Ref{Any}(nothing)
26+
27+
# Callback for `signatures_at` (lookup by file/lineno). `lookupfunc = expressions_callback[]`
28+
# must have the form
29+
# mod, exsigs = lookupfunc(id, relpath)
30+
# where
31+
# id is the PkgId of the corresponding package
32+
# relpath is the path of the file from the basedir of `id`
33+
# mod is the "active" module at that point in the source
34+
# exsigs is a ex=>sigs dictionary, where `ex` is the source expression and `sigs`
35+
# a list of method-signatures defined by that expression.
36+
const expressions_callback = Ref{Any}(nothing)
37+
2338

2439
### Public API
2540

0 commit comments

Comments
 (0)