Skip to content
Open
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 = "2.0.2"
version = "3.0.0"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
18 changes: 16 additions & 2 deletions src/CodeTracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,27 @@ include("utils.jl")

# These values get populated by Revise

# `method_info[mt => sig]` is either:
# `method_info[MethodInfoKey(mt, 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
# one definition. The last pair in the list is the currently-active definition.

const MethodInfoKey = Pair{Union{Nothing, MethodTable}, Type}
struct MethodInfoKey
mt::Union{Nothing, MethodTable}
sig::Type
MethodInfoKey(mt::Union{Nothing, MethodTable}, @nospecialize(sig::Type)) = new(mt, sig)
end

function Base.iterate(mt_sig::MethodInfoKey, s::Union{Int,Nothing}=nothing)
if s === nothing
return mt_sig.mt, 1
elseif s == 1
return mt_sig.sig, 2
else
return nothing
end
end

const method_info = IdDict{MethodInfoKey,Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()

Expand Down
Loading