File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
julia 0.4
2
+ Compat 0.25
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ __precompile__(true)
2
2
3
3
module Mocking
4
4
5
+ import Compat: invokelatest
6
+
5
7
include (" expr.jl" )
6
8
7
9
export @patch , @mock , Patch, apply
@@ -182,15 +184,15 @@ macro mock(expr)
182
184
args_var = gensym (" args" )
183
185
184
186
# Note: The fix to Julia issue #265 (PR #17057) introduced changes where no compiled
185
- # calls could be made to functions compiled afterwards. Since the `apply` do block
186
- # syntax compiles the do block function before evaluating the do "outer" function this
187
- # means our patch functions will be compiled after the "inner" function.
188
- # Also note that we need to QuoteNode args_var to handle Symbols in args_var .
187
+ # calls could be made to functions compiled afterwards. Since the `Mocking. apply`
188
+ # do-block syntax compiles the body of the do- block function before evaluating the
189
+ # "outer" function this means our patch functions will be compiled after the "inner"
190
+ # function .
189
191
result = quote
190
192
local $ env_var = Mocking. get_active_env ()
191
193
local $ args_var = tuple ($ (args... ))
192
194
if Mocking. ismocked ($ env_var, $ func_name, $ args_var)
193
- eval ( Expr ( :call , $ env_var. mod.$ func, map (QuoteNode, $ args_var) ... ) )
195
+ Mocking . invokelatest ( $ env_var. mod.$ func, $ args_var... )
194
196
else
195
197
$ func ($ args_var... )
196
198
end
You can’t perform that action at this time.
0 commit comments