aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/core_lib.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-01-29 09:40:42 +0100
committerBjörn Gustavsson <[email protected]>2015-01-29 09:40:42 +0100
commit47f77f2576ca02243ed22d9e42b09eb7415ee3a1 (patch)
tree853c99efa58482ed03182593ad3f3c5b77b6c384 /lib/compiler/src/core_lib.erl
parentf5aa1d9943fbf401fed9799c204e893d0d4b4644 (diff)
parent70478d290046844b504c8fe0643e499009b735b4 (diff)
downloadotp-47f77f2576ca02243ed22d9e42b09eb7415ee3a1.tar.gz
otp-47f77f2576ca02243ed22d9e42b09eb7415ee3a1.tar.bz2
otp-47f77f2576ca02243ed22d9e42b09eb7415ee3a1.zip
Merge branch 'bjorn/compiler/map-fixes'
* bjorn/compiler/map-fixes: cerl: Remove a clause in fold_map_pairs/3 that will never be reached Move grouping of map constructions from v3_core to v3_kernel core_pp: Correct printing of map literals Strengthen and modernize compile_SUITE core_parse: Always fold literal conses cerl: Make sure that we preserve the invariants for maps cerl_clauses: Fix indentation sys_core_fold: Strengthen optimization of letrecs in effect context Fix handling of binary map keys in comprehensions core_lib: Teach is_var_used/2 to handle keys in map patterns warnings_SUITE: Eliminate compiler warning for a shadowed variable lc_SUITE: Add shadow/1 Modernize lc_SUITE
Diffstat (limited to 'lib/compiler/src/core_lib.erl')
-rw-r--r--lib/compiler/src/core_lib.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/compiler/src/core_lib.erl b/lib/compiler/src/core_lib.erl
index 0d95971f91..730e3a5317 100644
--- a/lib/compiler/src/core_lib.erl
+++ b/lib/compiler/src/core_lib.erl
@@ -236,10 +236,15 @@ vu_pat_seg_list(V, Ss, St) ->
end
end, St, Ss).
-vu_map_pairs(V, [#c_map_pair{val=Pat}|T], St0) ->
- case vu_pattern(V, Pat, St0) of
- {true,_}=St -> St;
- St -> vu_map_pairs(V, T, St)
+vu_map_pairs(V, [#c_map_pair{key=Key,val=Pat}|T], St0) ->
+ case vu_expr(V, Key) of
+ true ->
+ {true,false};
+ false ->
+ case vu_pattern(V, Pat, St0) of
+ {true,_}=St -> St;
+ St -> vu_map_pairs(V, T, St)
+ end
end;
vu_map_pairs(_, [], St) -> St.