From cf3f89f644cd898479af3f9d430473c5d03a7606 Mon Sep 17 00:00:00 2001 From: Vadim Tsvetkov Date: Sat, 16 Apr 2022 19:44:27 +0300 Subject: [PATCH] Make Witchcraft.Chain.do_notation respect chainer --- lib/witchcraft/chain.ex | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/witchcraft/chain.ex b/lib/witchcraft/chain.ex index 74a887e..d27e875 100644 --- a/lib/witchcraft/chain.ex +++ b/lib/witchcraft/chain.ex @@ -407,7 +407,7 @@ defclass Witchcraft.Chain do @doc false # credo:disable-for-lines:31 Credo.Check.Refactor.Nesting - def do_notation(input, _chainer) do + def do_notation(input, chainer) do input |> normalize() |> Enum.reverse() @@ -416,17 +416,10 @@ defclass Witchcraft.Chain do quote do: unquote(value) |> (fn unquote(assign) -> unquote(continue) end).() continue, {:<-, _, [assign, value]} -> - quote do - import Witchcraft.Chain, only: [>>>: 2] - - unquote(value) >>> fn unquote(assign) -> unquote(continue) end - end + quote do: unquote(value) |> unquote(chainer).(fn unquote(assign) -> unquote(continue) end) continue, value -> - quote do - import Witchcraft.Chain, only: [>>>: 2] - unquote(value) >>> fn _ -> unquote(continue) end - end + quote do: unquote(value) |> unquote(chainer).(fn _ -> unquote(continue) end) end) end