Fix unsafe use of var

This commit is contained in:
Tuncer Ayaz 2012-06-08 22:14:32 +02:00
parent 8a046d898a
commit b1d06a4d14

View file

@ -202,20 +202,21 @@ inspect(Source, IncludePath) ->
inspect_epp(Epp, Source, Module, Includes) -> inspect_epp(Epp, Source, Module, Includes) ->
case epp:parse_erl_form(Epp) of case epp:parse_erl_form(Epp) of
{ok, {attribute, _, module, ModInfo}} -> {ok, {attribute, _, module, ModInfo}} ->
ActualModuleStr =
case ModInfo of case ModInfo of
%% Typical module name, single atom %% Typical module name, single atom
ActualModule when is_atom(ActualModule) -> ActualModule when is_atom(ActualModule) ->
ActualModuleStr = atom_to_list(ActualModule); atom_to_list(ActualModule);
%% Packag-ized module name, list of atoms %% Packag-ized module name, list of atoms
ActualModule when is_list(ActualModule) -> ActualModule when is_list(ActualModule) ->
ActualModuleStr = string:join([atom_to_list(P) || string:join([atom_to_list(P) ||
P <- ActualModule], "."); P <- ActualModule], ".");
%% Parameterized module name, single atom %% Parameterized module name, single atom
{ActualModule, _} when is_atom(ActualModule) -> {ActualModule, _} when is_atom(ActualModule) ->
ActualModuleStr = atom_to_list(ActualModule); atom_to_list(ActualModule);
%% Parameterized and packagized module name, list of atoms %% Parameterized and packagized module name, list of atoms
{ActualModule, _} when is_list(ActualModule) -> {ActualModule, _} when is_list(ActualModule) ->
ActualModuleStr = string:join([atom_to_list(P) || string:join([atom_to_list(P) ||
P <- ActualModule], ".") P <- ActualModule], ".")
end, end,
inspect_epp(Epp, Source, ActualModuleStr, Includes); inspect_epp(Epp, Source, ActualModuleStr, Includes);