@@ -175,15 +175,16 @@ function signatures_at(id::PkgId, relpath::AbstractString, line::Integer)
175175end
176176
177177"""
178- src, line1 = definition(method::Method, String )
178+ src, line1 = definition(String, method::Method)
179179
180180Return a string with the code that defines `method`. Also return the first line of the
181- definition, including the signature.
181+ definition, including the signature (which may not be the same line number returned
182+ by `whereis`).
182183
183184Note this may not be terribly useful for methods that are defined inside `@eval` statements;
184- see [`definition(method::Method, Expr )`](@ref) instead.
185+ see [`definition(Expr, method::Method)`](@ref) instead.
185186"""
186- function definition(method :: Method , :: Type{String} )
187+ function definition(:: Type{String} , method :: Method )
187188 file, line = whereis(method)
188189 src = read(file, String)
189190 eol = isequal(' \n ' )
@@ -209,12 +210,12 @@ function definition(method::Method, ::Type{String})
209210end
210211
211212"""
212- ex = definition(method::Method, Expr )
213+ ex = definition(Expr, method::Method)
213214 ex = definition(method::Method)
214215
215216Return an expression that defines `method`.
216217"""
217- function definition(method :: Method , :: Type{Expr} )
218+ function definition(:: Type{Expr} , method :: Method )
218219 def = get(method_info, method. sig, nothing )
219220 if def === nothing
220221 f = method_lookup_callback[]
@@ -229,7 +230,7 @@ function definition(method::Method, ::Type{Expr})
229230 return def === nothing || ismissing(def) ? nothing : copy(def[2 ])
230231end
231232
232- definition(method:: Method ) = definition(method, Expr )
233+ definition(method:: Method ) = definition(Expr, method )
233234
234235"""
235236 info = pkgfiles(name::AbstractString)
0 commit comments