diff options
author | Björn Gustavsson <[email protected]> | 2016-04-25 08:13:54 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-04-25 08:13:54 +0200 |
commit | a8527fac1e63f7b01dcd54f010adacdfb5816b82 (patch) | |
tree | d2763b65a9262a5d3521b950d305d4e3a17ad586 /lib/compiler/src/cerl_trees.erl | |
parent | 1d51d64979116d14258555c0c61e2a911110424b (diff) | |
parent | 9f1a4c94b57d3ead1d098d236260771f935336c8 (diff) | |
download | otp-a8527fac1e63f7b01dcd54f010adacdfb5816b82.tar.gz otp-a8527fac1e63f7b01dcd54f010adacdfb5816b82.tar.bz2 otp-a8527fac1e63f7b01dcd54f010adacdfb5816b82.zip |
Merge branch 'bjorn/compiler/core-erlang-fixes'
* bjorn/compiler/core-erlang-fixes:
Add compile_SUITE:core_roundtrip/1
v3_core: Construct {badmap,Map} as literal if possible
core_pp: Print {file,File} annotations more compactly
core_pp: Add format_all/1 that prints all annotations
core_parse: Don't sort map patterns
core_parse: Handle annotations in more contexts
cerl_trees: Correct handling of maps in label/2
cerl: Add missing API function is_c_map_pattern/1
Diffstat (limited to 'lib/compiler/src/cerl_trees.erl')
-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), |