Skip to content

Commit 9153d73

Browse files
committed
Address compilation on Erlang/OTP 24
1 parent 6d4811a commit 9153d73

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/elixir/src/elixir.erl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ eval_forms(Tree, Binding, OrigE, Opts) ->
358358
_ -> [Erl]
359359
end,
360360

361-
ExternalHandler = eval_external_handler(),
361+
ExternalHandler = {value, fun ?MODULE:eval_external_handler/3},
362362

363363
{value, Value, NewBinding} =
364364
try
@@ -387,8 +387,6 @@ eval_forms(Tree, Binding, OrigE, Opts) ->
387387

388388
%% TODO: Remove conditional once we require Erlang/OTP 25+.
389389
-if(?OTP_RELEASE >= 25).
390-
eval_external_handler() -> {value, fun ?MODULE:eval_external_handler/3}.
391-
392390
eval_external_handler(Ann, FunOrModFun, Args) ->
393391
try
394392
case FunOrModFun of
@@ -452,7 +450,11 @@ drop_common([], [{?MODULE, _, _, _} | T2], _ToDrop) -> T2;
452450
drop_common([], [_ | T2], true) -> T2;
453451
drop_common([], T2, _) -> T2.
454452
-else.
455-
eval_external_handler() -> none.
453+
eval_external_handler(_Ann, FunOrModFun, Args) ->
454+
case FunOrModFun of
455+
{Mod, Fun} -> apply(Mod, Fun, Args);
456+
Fun -> apply(Fun, Args)
457+
end.
456458
-endif.
457459

458460
%% Converts a quoted expression to Erlang abstract format

0 commit comments

Comments
 (0)