@@ -34,7 +34,10 @@ include("utils.jl")
3434# - a list of `(lnn,ex)` pairs. In almost all cases there will be just one of these,
3535# but "mistakes" in moving methods from one file to another can result in more than
3636# one definition. The last pair in the list is the currently-active definition.
37- const method_info = IdDict{Pair{Union{Nothing, MethodTable}, Type},Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()
37+
38+ const MethodInfoKey = Pair{Union{Nothing, MethodTable}, Type}
39+
40+ const method_info = IdDict{MethodInfoKey,Union{Missing,Vector{Tuple{LineNumberNode,Expr}}}}()
3841
3942const _pkgfiles = Dict {PkgId,PkgFiles} ()
4043
@@ -59,7 +62,7 @@ const juliabase = joinpath("julia", "base")
5962const juliastdlib = joinpath (" julia" , " stdlib" , " v$(VERSION . major) .$(VERSION . minor) " )
6063
6164method_table (method:: Method ) = isdefined (method, :external_mt ) ? method. external_mt:: MethodTable : nothing
62- method_info_key (method:: Method ) = Pair {Union{Nothing, MethodTable}, Type} (method_table (method), method. sig)
65+ MethodInfoKey (method:: Method ) = MethodInfoKey (method_table (method), method. sig)
6366
6467# ## Public API
6568
@@ -73,13 +76,13 @@ the method declaration, otherwise it is the first line of the method's body.
7376function whereis (method:: Method )
7477 file, line = String (method. file), method. line
7578 startswith (file, " REPL[" ) && return file, line
76- lin = get (method_info, method_info_key (method), nothing )
79+ lin = get (method_info, MethodInfoKey (method), nothing )
7780 if lin === nothing
7881 f = method_lookup_callback[]
7982 if f != = nothing
8083 try
8184 Base. invokelatest (f, method)
82- lin = get (method_info, method_info_key (method), nothing )
85+ lin = get (method_info, MethodInfoKey (method), nothing )
8386 catch
8487 end
8588 end
@@ -301,13 +304,13 @@ See also [`code_expr`](@ref).
301304"""
302305function definition (:: Type{Expr} , method:: Method )
303306 file = String (method. file)
304- def = startswith (file, " REPL[" ) ? nothing : get (method_info, method_info_key (method), nothing )
307+ def = startswith (file, " REPL[" ) ? nothing : get (method_info, MethodInfoKey (method), nothing )
305308 if def === nothing
306309 f = method_lookup_callback[]
307310 if f != = nothing
308311 try
309312 Base. invokelatest (f, method)
310- def = get (method_info, method_info_key (method), nothing )
313+ def = get (method_info, MethodInfoKey (method), nothing )
311314 catch
312315 end
313316 end
0 commit comments