Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

which(io, f, args) #5467

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 6 additions & 4 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,24 @@ end

# searching definitions

function whicht(f, types)
function whicht(io::IO, f, types)
for m in methods(f, types)
lsd = m.func.code::LambdaStaticData
d = f.env.defs
while !is(d,())
if is(d.func.code, lsd)
print(STDOUT, f.env.name)
show(STDOUT, d); println(STDOUT)
print(io, f.env.name)
show(io, d); println(io)
return
end
d = d.next
end
end
end

which(f, args...) = whicht(f, map(a->(isa(a,Type) ? Type{a} : typeof(a)), args))
which(io::IO, f, args...) = whicht(io, f, map(a->(isa(a,Type) ? Type{a} : typeof(a)), args))

which(f, args) = which(STDOUT, f, args)

macro which(ex0)
if isa(ex0,Expr) &&
Expand Down