diff options
author | Björn Gustavsson <[email protected]> | 2016-04-19 09:27:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-04-21 12:39:40 +0200 |
commit | 743c176426b956bce36c34ae1b873be9310a91de (patch) | |
tree | b5be01af078564b35d63a56fa3ab8cfe77d48f51 /lib/compiler | |
parent | 679274088e5d9825a629ebfd2ba99049030153ba (diff) | |
download | otp-743c176426b956bce36c34ae1b873be9310a91de.tar.gz otp-743c176426b956bce36c34ae1b873be9310a91de.tar.bz2 otp-743c176426b956bce36c34ae1b873be9310a91de.zip |
cerl_trees: Correct handling of maps in label/2
Make sure that we don't convert a map pattern to a map expression.
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/cerl_trees.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/compiler/src/cerl_trees.erl b/lib/compiler/src/cerl_trees.erl index 6d38748964..b3decbec1f 100644 --- a/lib/compiler/src/cerl_trees.erl +++ b/lib/compiler/src/cerl_trees.erl @@ -61,6 +61,7 @@ map_arg/1, map_es/1, ann_c_map/3, update_c_map/3, + is_c_map_pattern/1, ann_c_map_pattern/2, map_pair_key/1,map_pair_val/1,map_pair_op/1, ann_c_map_pair/4, update_c_map_pair/4 @@ -752,10 +753,17 @@ label(T, N, Env) -> {As, N2} = label_ann(T, N1), {ann_c_tuple_skel(As, Ts), N2}; map -> - {M, N1} = label(map_arg(T), N, Env), - {Ts, N2} = label_list(map_es(T), N1, Env), - {As, N3} = label_ann(T, N2), - {ann_c_map(As, M, Ts), N3}; + case is_c_map_pattern(T) of + false -> + {M, N1} = label(map_arg(T), N, Env), + {Ts, N2} = label_list(map_es(T), N1, Env), + {As, N3} = label_ann(T, N2), + {ann_c_map(As, M, Ts), N3}; + true -> + {Ts, N1} = label_list(map_es(T), N, Env), + {As, N2} = label_ann(T, N1), + {ann_c_map_pattern(As, Ts), N2} + end; map_pair -> {Op, N1} = label(map_pair_op(T), N, Env), {Key, N2} = label(map_pair_key(T), N1, Env), |