Skip to content

Commit

Permalink
Merge pull request #5646 from WestleyArgentum/which
Browse files Browse the repository at this point in the history
change which to return rather than show
  • Loading branch information
JeffBezanson committed Feb 6, 2014
2 parents 570f5f7 + 9c34cdf commit 31ecf33
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ function whicht(f, types)
d = f.env.defs
while !is(d,())
if is(d.func.code, lsd)
display(d)
return
return d
end
d = d.next
end
end
end

which(f, args...) = whicht(f, map(a->(isa(a,Type) ? Type{a} : typeof(a)), args))
function which(f, args...)
method = whicht(f, map(a->(isa(a,Type) ? Type{a} : typeof(a)), args))
method != nothing ? method : throw(MethodError(f, args))
end

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

0 comments on commit 31ecf33

Please sign in to comment.