Browse Source

Ensure transform options are sorted before merge

pull/392/head
Michael Kokich 8 years ago
committed by GitHub
parent
commit
39a6055d9e
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/lager_transform.erl

+ 2
- 2
src/lager_transform.erl View File

@ -36,7 +36,7 @@ parse_transform(AST, Options) ->
put(print_records_flag, Enable),
put(truncation_size, TruncSize),
put(sinks, Sinks),
put(functions, Functions),
put(functions, lists:keysort(1, Functions)),
erlang:put(records, []),
%% .app file should either be in the outdir, or the same dir as the source file
guess_application(proplists:get_value(outdir, Options), hd(AST)),
@ -59,7 +59,7 @@ walk_ast(Acc, [{attribute, _, module, Module}=H|T]) ->
walk_ast(Acc, [{attribute, _, lager_function_transforms, FromModule }=H|T]) ->
%% Merge transform options from the module over the compile options
FromOptions = get(functions),
put(functions, orddict:merge(fun(_Key, _V1, V2) -> V2 end, FromOptions, FromModule)),
put(functions, orddict:merge(fun(_Key, _V1, V2) -> V2 end, FromOptions, lists:keysort(1, FromModule))),
walk_ast([H|Acc], T);
walk_ast(Acc, [{function, Line, Name, Arity, Clauses}|T]) ->
put(function, Name),

Loading…
Cancel
Save