Skip to content

Commit

Permalink
use jl_gf_invoke_lookup in typeinf to lookup the method to be called
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Apr 26, 2015
1 parent 7475f8d commit f4c40e9
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -706,26 +706,20 @@ function invoke_tfunc(f, types, argtype)
if is(argtype,Bottom)
return Bottom
end
applicable = _methods(f, types, -1)
if isempty(applicable)
meth = ccall(:jl_gf_invoke_lookup, Any, (Any, Any), f, types)
if is(meth, nothing)
return Any
end
for (m::SimpleVector) in applicable
local linfo
try
linfo = func_for_method(m[3],types,m[2])
catch
return Any
end
if typeseq(m[1],types)
tvars = m[2][1:2:end]
(ti, env) = ccall(:jl_match_method, Any, (Any,Any,Any),
argtype, m[1], tvars)::SimpleVector
(_tree,rt) = typeinf(linfo, ti, env, linfo)
return rt
end
(ti, env) = ccall(:jl_match_method, Any, (Any, Any, Any),
argtype, meth.sig, meth.tvars)::SimpleVector
local linfo
try
linfo = func_for_method(meth, types, env)
catch
return Any
end
return Any
(_tree, rt) = typeinf(linfo, ti, env, linfo)
return rt
end

# `types` is an array of inferred types for expressions in `args`.
Expand Down

0 comments on commit f4c40e9

Please sign in to comment.