@@ -19,7 +19,12 @@ include("utils.jl")
1919
2020# These values get populated by Revise
2121
22- const method_info = IdDict {Type,Union{Missing,Tuple{LineNumberNode,Expr}}} ()
22+ # `method_info[sig]` is either:
23+ # - `missing`, to indicate that the method cannot be located
24+ # - a list of `(lnn,ex)` pairs. In almost all cases there will be just one of these,
25+ # but "mistakes" in moving methods from one file to another can result in more than
26+ # definition. The last pair in the list is the currently-active definition.
27+ const method_info = IdDict{Type,Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()
2328
2429const _pkgfiles = Dict {PkgId,PkgFiles} ()
2530
@@ -68,7 +73,7 @@ function whereis(method::Method)
6873 end
6974 if lin === nothing || ismissing (lin)
7075 else
71- file, line = fileline (lin[1 ])
76+ file, line = fileline (lin[end ][ 1 ])
7277 end
7378 file = maybe_fix_path (file)
7479 return file, line
@@ -251,7 +256,7 @@ function definition(::Type{Expr}, method::Method)
251256 end
252257 end
253258 end
254- return def === nothing || ismissing (def) ? nothing : copy (def[2 ])
259+ return def === nothing || ismissing (def) ? nothing : copy (def[end ][ 2 ])
255260end
256261
257262definition (method:: Method ) = definition (Expr, method)
0 commit comments