From 43bca6d2973c4cf27d182e4dad7e260fac036314 Mon Sep 17 00:00:00 2001 From: Serge Aleynikov Date: Sat, 19 Dec 2015 12:23:34 -0500 Subject: Turn functor into a function to support older Erlang VM --- src/rebar_state.erl | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/rebar_state.erl b/src/rebar_state.erl index 7d301ea..9c293f5 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -411,17 +411,16 @@ to_list(#state_t{} = State) -> Fields = record_info(fields, state_t), Values = tl(tuple_to_list(State)), DictSz = tuple_size(dict:new()), - Fun = fun - F({K,V}) when is_list(V) -> - {K, [F(I) || I <- V]}; - F(V) when is_tuple(V), element(1,V) =:= dict, tuple_size(V) =:= DictSz -> - [F(I) || I <- dict:to_list(V)]; - F({K,V}) when is_tuple(V), element(1,V) =:= dict, tuple_size(V) =:= DictSz -> - {K, [F(I) || I <- dict:to_list(V)]}; - F(Other) -> - Other - end, - lists:zip(Fields, [Fun(I) || I <- Values]). + lists:zip(Fields, [reformat(I, DictSz) || I <- Values]). + +reformat({K,V}, DSz) when is_list(V) -> + {K, [reformat(I, DSz) || I <- V]}; +reformat(V, DSz) when is_tuple(V), element(1,V) =:= dict, tuple_size(V) =:= DSz -> + [reformat(I, DSz) || I <- dict:to_list(V)]; +reformat({K,V}, DSz) when is_tuple(V), element(1,V) =:= dict, tuple_size(V) =:= DSz -> + {K, [reformat(I, DSz) || I <- dict:to_list(V)]}; +reformat(Other, _DSz) -> + Other. %% =================================================================== %% Internal functions -- cgit v1.1