diff options
author | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2019-07-22 15:32:28 +0200 |
---|---|---|
committer | Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> | 2019-07-22 15:32:40 +0200 |
commit | 8c0ed151287f5d4fc65cf79706600ce902a0dfd3 (patch) | |
tree | c7d5e94ffc3c303a9b6af4794e9ca0e02f053c8e | |
parent | f76b693aef5ea87d17c3a7992c532cc8fb51b8c8 (diff) | |
download | elixir-emj/gp-dependent-modules.tar.gz |
Inline get_chunkemj/gp-dependent-modules
-rw-r--r-- | lib/elixir/lib/module/checker.ex | 12 | ||||
-rw-r--r-- | lib/elixir/lib/module/parallel_checker.ex | 10 |
2 files changed, 3 insertions, 19 deletions
diff --git a/lib/elixir/lib/module/checker.ex b/lib/elixir/lib/module/checker.ex index fab07fa57..39fa87535 100644 --- a/lib/elixir/lib/module/checker.ex +++ b/lib/elixir/lib/module/checker.ex @@ -28,16 +28,8 @@ defmodule Module.Checker do end end - defp get_chunk(binary, chunk_name) do - case :beam_lib.chunks(binary, [chunk_name], [:allow_missing_chunks]) do - {:ok, {_module, [{^chunk_name, :missing_chunk}]}} -> :error - {:ok, {_module, [{^chunk_name, chunk}]}} -> {:ok, chunk} - :error -> :error - end - end - defp debug_info(module, binary) do - with {:ok, chunk} <- get_chunk(binary, :debug_info), + with {:ok, {_, [debug_info: chunk]}} <- :beam_lib.chunks(binary, [:debug_info]), {:debug_info_v1, backend, data} <- chunk, {:ok, info} <- backend.debug_info(:elixir_v1, module, data, []) do {:ok, %{definitions: info.definitions, file: info.relative_file}} @@ -47,7 +39,7 @@ defmodule Module.Checker do end defp checker_chunk(binary) do - with {:ok, chunk} <- get_chunk(binary, 'ExCk'), + with {:ok, {_, [{'ExCk', chunk}]}} <- :beam_lib.chunks(binary, ['ExCk']), {:elixir_checker_v1, contents} <- :erlang.binary_to_term(chunk) do deprecated = Enum.map(contents.exports, fn {fun, {_kind, reason}} -> {fun, reason} end) {:ok, %{deprecated: deprecated, no_warn_undefined: contents.no_warn_undefined}} diff --git a/lib/elixir/lib/module/parallel_checker.ex b/lib/elixir/lib/module/parallel_checker.ex index 48c79428f..323b159aa 100644 --- a/lib/elixir/lib/module/parallel_checker.ex +++ b/lib/elixir/lib/module/parallel_checker.ex @@ -230,7 +230,7 @@ defmodule Module.ParallelChecker do end defp cache_from_chunk(ets, module, binary) do - with {:ok, chunk} <- get_chunk(binary), + with {:ok, {_, [{'ExCk', chunk}]}} <- :beam_lib.chunks(binary, ['ExCk']), {:elixir_checker_v1, contents} <- :erlang.binary_to_term(chunk) do cache_chunk(ets, module, contents.exports) true @@ -255,14 +255,6 @@ defmodule Module.ParallelChecker do end end - defp get_chunk(binary) do - case :beam_lib.chunks(binary, ['ExCk'], [:allow_missing_chunks]) do - {:ok, {_module, [{'ExCk', :missing_chunk}]}} -> :error - {:ok, {_module, [{'ExCk', chunk}]}} -> {:ok, chunk} - :error -> :error - end - end - defp info_exports(module) do :maps.from_list( [{{:__info__, 1}, :def}] ++ |