summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Aleynikov <saleyn@gmail.com>2015-12-19 12:23:34 -0500
committerSerge Aleynikov <saleyn@gmail.com>2016-02-08 19:22:52 -0500
commit43bca6d2973c4cf27d182e4dad7e260fac036314 (patch)
tree682b822650d7173276141ae90b637415bf0b3643
parentce1dba7f437a5970f97076c3ec0d209b757f104e (diff)
Turn functor into a function to support older Erlang VM
-rw-r--r--src/rebar_state.erl21
1 files 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