Skip to content

Commit 0c07b01

Browse files
committed
fix(ci): group __using__ macro clauses together to eliminate compile warning
Moved __on_reducer_definition__ helper function after all __using__ macro definitions. This groups the :reducer, :process, and :process_link macros together as required by Elixir, eliminating the compile warning about ungrouped macro clauses. Fixes CI compile check failure.
1 parent 224eb46 commit 0c07b01

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

lib/phoenix/session_process.ex

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,23 +1002,6 @@ defmodule Phoenix.SessionProcess do
10021002
end
10031003
end
10041004

1005-
@doc false
1006-
def __on_reducer_definition__(env, _kind, _name, _args, _guards, _body) do
1007-
module = env.module
1008-
1009-
# Check for @throttle attribute
1010-
if throttle = Module.get_attribute(module, :throttle) do
1011-
Phoenix.SessionProcess.Redux.ReducerCompiler.register_throttle(module, throttle)
1012-
Module.delete_attribute(module, :throttle)
1013-
end
1014-
1015-
# Check for @debounce attribute
1016-
if debounce = Module.get_attribute(module, :debounce) do
1017-
Phoenix.SessionProcess.Redux.ReducerCompiler.register_debounce(module, debounce)
1018-
Module.delete_attribute(module, :debounce)
1019-
end
1020-
end
1021-
10221005
# credo:disable-for-next-line Credo.Check.Refactor.LongQuoteBlocks
10231006
defmacro __using__(:process) do
10241007
quote do
@@ -1385,7 +1368,8 @@ defmodule Phoenix.SessionProcess do
13851368

13861369
# Format 3: {name, Module, action_prefix} - explicit name and action_prefix
13871370
{name, module, action_prefix}, acc
1388-
when is_atom(name) and is_atom(module) and (is_binary(action_prefix) or is_nil(action_prefix)) ->
1371+
when is_atom(name) and is_atom(module) and
1372+
(is_binary(action_prefix) or is_nil(action_prefix)) ->
13891373
validate_reducer_module!(module)
13901374

13911375
if Map.has_key?(acc, name) do
@@ -1705,4 +1689,21 @@ defmodule Phoenix.SessionProcess do
17051689
use Phoenix.SessionProcess, :process
17061690
end
17071691
end
1692+
1693+
@doc false
1694+
def __on_reducer_definition__(env, _kind, _name, _args, _guards, _body) do
1695+
module = env.module
1696+
1697+
# Check for @throttle attribute
1698+
if throttle = Module.get_attribute(module, :throttle) do
1699+
Phoenix.SessionProcess.Redux.ReducerCompiler.register_throttle(module, throttle)
1700+
Module.delete_attribute(module, :throttle)
1701+
end
1702+
1703+
# Check for @debounce attribute
1704+
if debounce = Module.get_attribute(module, :debounce) do
1705+
Phoenix.SessionProcess.Redux.ReducerCompiler.register_debounce(module, debounce)
1706+
Module.delete_attribute(module, :debounce)
1707+
end
1708+
end
17081709
end

lib/phoenix/session_process/redux/reducer_compiler.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ defmodule Phoenix.SessionProcess.Redux.ReducerCompiler do
7676
# action_prefix can be nil or "" to indicate no prefix
7777
action_prefix =
7878
cond do
79-
action_prefix == nil and Module.get_attribute(env.module, :action_prefix, :__not_set__) == :__not_set__ ->
79+
action_prefix == nil and
80+
Module.get_attribute(env.module, :action_prefix, :__not_set__) == :__not_set__ ->
8081
# @action_prefix not set at all, default to stringified name
8182
to_string(name)
8283

0 commit comments

Comments
 (0)