diff --git a/Project.toml b/Project.toml index 58b9707..099ecda 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Memoization" uuid = "6fafb56a-5788-4b4e-91ca-c0cea6611c73" authors = ["Marius Millea "] -version = "0.2" +version = "0.2.1" [deps] MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" diff --git a/src/Memoization.jl b/src/Memoization.jl index fa21c5a..125b6cc 100644 --- a/src/Memoization.jl +++ b/src/Memoization.jl @@ -201,12 +201,12 @@ end function _memoized_call(cache_constructor, cacheid_get, getter_body, args, kwargs) - T, getter = gensym.(("T","getter")) + T, getter, cache = gensym.(("T","getter","cache")) quote - cache = $get_cache($cache_constructor, $cacheid_get) + $cache = $get_cache($cache_constructor, $cacheid_get) ($getter)() = $getter_body $T = $(Core.Compiler.return_type)($getter, $Tuple{}) - $_get!($getter, cache, (($(args...),), ($(kwargs...),))) :: $T + $_get!($getter, $cache, (($(args...),), ($(kwargs...),))) :: $T end end