aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/cerl_trees.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-01-13 18:05:00 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-29 11:08:48 +0100
commit5b4b6c9b6bd1cf258841004f2e11bb2a82ebfe24 (patch)
tree380181058a169355343424f64e0feccda64f60ec /lib/compiler/src/cerl_trees.erl
parent1f6c5e88f4f387cc27c9affbdf1ceaae7cfdcfd3 (diff)
downloadotp-5b4b6c9b6bd1cf258841004f2e11bb2a82ebfe24.tar.gz
otp-5b4b6c9b6bd1cf258841004f2e11bb2a82ebfe24.tar.bz2
otp-5b4b6c9b6bd1cf258841004f2e11bb2a82ebfe24.zip
compiler: Squash #c_map_pair_*{} to #c_map_pair{}
Simplify compiler internals and parsing of core format.
Diffstat (limited to 'lib/compiler/src/cerl_trees.erl')
-rw-r--r--lib/compiler/src/cerl_trees.erl65
1 files changed, 31 insertions, 34 deletions
diff --git a/lib/compiler/src/cerl_trees.erl b/lib/compiler/src/cerl_trees.erl
index dc1cc606b3..2542841eef 100644
--- a/lib/compiler/src/cerl_trees.erl
+++ b/lib/compiler/src/cerl_trees.erl
@@ -58,11 +58,11 @@
update_c_values/2, values_es/1, var_name/1,
map_es/1,
- update_c_map_skel/2,
- update_c_map_pair_assoc_skel/2, update_c_map_pair_exact_skel/2,
- ann_c_map_skel/2,
- ann_c_map_pair_assoc_skel/2, ann_c_map_pair_exact_skel/2,
- map_pair_assoc_es/1, map_pair_exact_es/1
+ ann_c_map/2,
+ update_c_map/2,
+ map_pair_key/1,map_pair_val/1,map_pair_op/1,
+ ann_c_map_pair/4,
+ update_c_map_pair/4
]).
@@ -138,11 +138,11 @@ map_1(F, T) ->
tuple ->
update_c_tuple_skel(T, map_list(F, tuple_es(T)));
map ->
- update_c_map_skel(T, map_list(F, map_es(T)));
- map_pair_assoc ->
- update_c_map_pair_assoc_skel(T, map_list(F, map_pair_assoc_es(T)));
- map_pair_exact ->
- update_c_map_pair_exact_skel(T, map_list(F, map_pair_exact_es(T)));
+ update_c_map(T, map_list(F, map_es(T)));
+ map_pair ->
+ update_c_map_pair(T, map(F, map_pair_op(T)),
+ map(F, map_pair_key(T)),
+ map(F, map_pair_val(T)));
'let' ->
update_c_let(T, map_list(F, let_vars(T)),
map(F, let_arg(T)),
@@ -251,10 +251,12 @@ fold_1(F, S, T) ->
fold_list(F, S, tuple_es(T));
map ->
fold_list(F, S, map_es(T));
- map_pair_assoc ->
- fold_list(F, S, map_pair_assoc_es(T));
- map_pair_exact ->
- fold_list(F, S, map_pair_exact_es(T));
+ map_pair ->
+ fold(F,
+ fold(F,
+ fold(F, S, map_pair_op(T)),
+ map_pair_key(T)),
+ map_pair_val(T));
'let' ->
fold(F, fold(F, fold_list(F, S, let_vars(T)),
let_arg(T)),
@@ -371,13 +373,12 @@ mapfold(F, S0, T) ->
F(update_c_tuple_skel(T, Ts), S1);
map ->
{Ts, S1} = mapfold_list(F, S0, map_es(T)),
- F(update_c_map_skel(T, Ts), S1);
- map_pair_assoc ->
- {Ts, S1} = mapfold_list(F, S0, map_pair_assoc_es(T)),
- F(update_c_map_pair_assoc_skel(T,Ts), S1);
- map_pair_exact ->
- {Ts, S1} = mapfold_list(F, S0, map_pair_exact_es(T)),
- F(update_c_map_pair_exact_skel(T,Ts), S1);
+ F(update_c_map(T, Ts), S1);
+ map_pair ->
+ {Op, S1} = mapfold(F, S0, map_pair_op(T)),
+ {Key, S2} = mapfold(F, S1, map_pair_key(T)),
+ {Val, S3} = mapfold(F, S2, map_pair_val(T)),
+ F(update_c_map_pair(T,Op,Key,Val), S3);
'let' ->
{Vs, S1} = mapfold_list(F, S0, let_vars(T)),
{A, S2} = mapfold(F, S1, let_arg(T)),
@@ -519,10 +520,8 @@ variables(T, S) ->
vars_in_list(tuple_es(T), S);
map ->
vars_in_list(map_es(T), S);
- map_pair_assoc ->
- vars_in_list(map_pair_assoc_es(T), S);
- map_pair_exact ->
- vars_in_list(map_pair_exact_es(T), S);
+ map_pair ->
+ vars_in_list([map_pair_op(T),map_pair_key(T), map_pair_val(T)], S);
'let' ->
Vs = variables(let_body(T), S),
Vs1 = var_list_names(let_vars(T)),
@@ -726,15 +725,13 @@ label(T, N, Env) ->
map ->
{Ts, N1} = label_list(map_es(T), N, Env),
{As, N2} = label_ann(T, N1),
- {ann_c_map_skel(As, Ts), N2};
- map_pair_assoc ->
- {Ts, N1} = label_list(map_pair_assoc_es(T), N, Env),
- {As, N2} = label_ann(T, N1),
- {ann_c_map_pair_assoc_skel(As, Ts), N2};
- map_pair_exact ->
- {Ts, N1} = label_list(map_pair_exact_es(T), N, Env),
- {As, N2} = label_ann(T, N1),
- {ann_c_map_pair_exact_skel(As, Ts), N2};
+ {ann_c_map(As, Ts), N2};
+ map_pair ->
+ {Op, N1} = label(map_pair_op(T), N, Env),
+ {Val, N2} = label(map_pair_key(T), N1, Env),
+ {Key, N3} = label(map_pair_val(T), N2, Env),
+ {As, N4} = label_ann(T, N3),
+ {ann_c_map_pair(As,Op,Key,Val), N4};
'let' ->
{A, N1} = label(let_arg(T), N, Env),
{Vs, N2, Env1} = label_vars(let_vars(T), N1, Env),