Skip to content

Commit

Permalink
Improve variable handing in key generators (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
hissssst authored Feb 24, 2024
1 parent 4071a9b commit 18b4d26
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/nebulex/caching/decorators.ex
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,16 @@ if Code.ensure_loaded?(Decorator.Define) do
walk(ast, acc)
end

defp walk({var, [{:line, _} | _], nil} = ast, acc) do
case "#{var}" do
"_" <> _ -> acc
_ -> [ast | acc]
defp walk({var, _meta, context} = ast, acc) when is_atom(context) and is_atom(var) do
cond do
match?("_" <> _, "#{var}") ->
acc

Macro.special_form?(var, 0) ->
acc

true ->
[ast | acc]
end
end

Expand Down

0 comments on commit 18b4d26

Please sign in to comment.