Skip to content

Commit 695915b

Browse files
author
José Valim
committed
Read the deprecated chunk directly as a list
1 parent cee5130 commit 695915b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/elixir/src/elixir_erl.erl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ debug_info(_, _, _, _) ->
4242
%% `ExDp` chunk from beam
4343

4444
deprecated_chunk_from_beam(Module) ->
45-
Chunk = binary_to_list(<<"ExDp">>),
4645
Beam = abstract_code_beam(Module),
4746

48-
{elixir_deprecated_v1, Deprecated} =
49-
case beam_lib:chunks(Beam, [Chunk]) of
50-
{ok, {Module, [{Chunk, DeprecatedBin}]}} -> binary_to_term(DeprecatedBin);
51-
_ -> {elixir_deprecated_v1, []}
52-
end,
53-
Deprecated.
47+
case beam_lib:chunks(Beam, ["ExDp"]) of
48+
{ok, {Module, [{_, DeprecatedBin}]}} ->
49+
{elixir_deprecated_v1, Deprecated} = binary_to_term(DeprecatedBin),
50+
Deprecated
51+
52+
_ ->
53+
[]
54+
end.
5455

5556
abstract_code_beam(Module) ->
5657
case code:get_object_code(Module) of

0 commit comments

Comments
 (0)