Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CodeTracking"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
authors = ["Tim Holy <tim.holy@gmail.com>"]
version = "0.5.11"
version = "1.0.0"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
11 changes: 8 additions & 3 deletions src/CodeTracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ include("utils.jl")

# These values get populated by Revise

const method_info = IdDict{Type,Union{Missing,Tuple{LineNumberNode,Expr}}}()
# `method_info[sig]` is either:
# - `missing`, to indicate that the method cannot be located
# - a list of `(lnn,ex)` pairs. In almost all cases there will be just one of these,
# but "mistakes" in moving methods from one file to another can result in more than
# definition. The last pair in the list is the currently-active definition.
const method_info = IdDict{Type,Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()

const _pkgfiles = Dict{PkgId,PkgFiles}()

Expand Down Expand Up @@ -68,7 +73,7 @@ function whereis(method::Method)
end
if lin === nothing || ismissing(lin)
else
file, line = fileline(lin[1])
file, line = fileline(lin[end][1])
end
file = maybe_fix_path(file)
return file, line
Expand Down Expand Up @@ -251,7 +256,7 @@ function definition(::Type{Expr}, method::Method)
end
end
end
return def === nothing || ismissing(def) ? nothing : copy(def[2])
return def === nothing || ismissing(def) ? nothing : copy(def[end][2])
end

definition(method::Method) = definition(Expr, method)
Expand Down