Stop silently supressing errors from process_attr/2

Otherwise the code cannot be safely refactored, since
potential new erros slip unnoticed.
This commit is contained in:
David Kubecka 2015-03-28 15:53:06 +01:00
parent fd482b661a
commit d61b51bcf8

View file

@ -672,14 +672,8 @@ parse_attrs(Fd, Includes) ->
end. end.
process_attr(Form, Includes) -> process_attr(Form, Includes) ->
try
AttrName = erl_syntax:atom_value(erl_syntax:attribute_name(Form)), AttrName = erl_syntax:atom_value(erl_syntax:attribute_name(Form)),
process_attr(AttrName, Form, Includes) process_attr(AttrName, Form, Includes).
catch _:_ ->
%% TODO: We should probably try to be more specific here
%% and not suppress all errors.
Includes
end.
process_attr(import, Form, Includes) -> process_attr(import, Form, Includes) ->
case erl_syntax_lib:analyze_import_attribute(Form) of case erl_syntax_lib:analyze_import_attribute(Form) of
@ -719,8 +713,12 @@ process_attr(compile, Form, Includes) ->
[atom_to_list(M) ++ ".erl"|Acc]; [atom_to_list(M) ++ ".erl"|Acc];
(_, Acc) -> (_, Acc) ->
Acc Acc
end, Includes, L) end, Includes, L);
end. _ ->
Includes
end;
process_attr(_, _Form, Includes) ->
Includes.
%% Given the filename from an include_lib attribute, if the path %% Given the filename from an include_lib attribute, if the path
%% exists, return unmodified, or else get the absolute ERL_LIBS %% exists, return unmodified, or else get the absolute ERL_LIBS