@@ -62,17 +62,24 @@ defmodule Module.ParallelChecker do
6262 if is_map ( info ) do
6363 info
6464 else
65- info |> File . read! ( ) |> fetch_module_map! ( module )
65+ info |> File . read! ( ) |> maybe_module_map ( module )
6666 end
6767
68- cache_from_module_map ( ets , module_map )
68+ module_map && cache_from_module_map ( ets , module_map )
6969 send ( checker , { ref , :cached } )
7070
7171 receive do
7272 { ^ ref , :check } ->
7373 # Set the compiler info so we can collect warnings
7474 :erlang . put ( :elixir_compiler_info , { pid , self ( ) } )
75- warnings = check_module ( module_map , { checker , ets } )
75+
76+ warnings =
77+ if module_map do
78+ check_module ( module_map , { checker , ets } )
79+ else
80+ [ ]
81+ end
82+
7683 send ( pid , { __MODULE__ , module , warnings } )
7784 send ( checker , { __MODULE__ , :done } )
7885 end
@@ -357,21 +364,15 @@ defmodule Module.ParallelChecker do
357364 _ -> % { }
358365 end
359366
360- defp fetch_module_map! ( binary , module ) when is_binary ( binary ) do
361- { :ok , { _ , [ debug_info: chunk ] } } = :beam_lib . chunks ( binary , [ :debug_info ] )
362- { :debug_info_v1 , backend , data } = chunk
363-
364- case backend . debug_info ( :elixir_v1 , module , data , [ ] ) do
365- { :ok , module_map } ->
366- module_map
367-
368- { :error , error } ->
369- raise """
370- could not load Elixir metadata for module #{ inspect ( module ) } , \
371- written in backend #{ inspect ( backend ) } , due to reason: #{ inspect ( error ) }
372-
373- Please report this bug: https://github.com/elixir-lang/elixir/issues
374- """
367+ defp maybe_module_map ( binary , module ) when is_binary ( binary ) do
368+ # If a module was compiled without debug_info,
369+ # then there is no module_map for further verification.
370+ with { :ok , { _ , [ debug_info: chunk ] } } <- :beam_lib . chunks ( binary , [ :debug_info ] ) ,
371+ { :debug_info_v1 , backend , data } = chunk ,
372+ { :ok , module_map } <- backend . debug_info ( :elixir_v1 , module , data , [ ] ) do
373+ module_map
374+ else
375+ _ -> nil
375376 end
376377 end
377378
0 commit comments