aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-01-21 10:17:46 +0100
committerBjörn Gustavsson <[email protected]>2015-01-21 10:17:46 +0100
commit046751dc8ca305a390aa4cf9ee132f0190d809f5 (patch)
treec723b2d314ea2fe44cf6c527dc2365c6e63d1acc /lib/compiler/src
parent1d0efcad490cb87c292c0505edbadb452b39b1a2 (diff)
parent2249ed70a95b238d37164a64abecfbde76f7dec2 (diff)
downloadotp-046751dc8ca305a390aa4cf9ee132f0190d809f5.tar.gz
otp-046751dc8ca305a390aa4cf9ee132f0190d809f5.tar.bz2
otp-046751dc8ca305a390aa4cf9ee132f0190d809f5.zip
Merge branch 'maint'
* maint: Update primary bootstrap core_lib: Handle patterns in map values
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/core_lib.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/compiler/src/core_lib.erl b/lib/compiler/src/core_lib.erl
index 2792fd8fa5..0d95971f91 100644
--- a/lib/compiler/src/core_lib.erl
+++ b/lib/compiler/src/core_lib.erl
@@ -212,6 +212,8 @@ vu_pattern(V, #c_tuple{es=Es}, St) ->
vu_pattern_list(V, Es, St);
vu_pattern(V, #c_binary{segments=Ss}, St) ->
vu_pat_seg_list(V, Ss, St);
+vu_pattern(V, #c_map{es=Es}, St) ->
+ vu_map_pairs(V, Es, St);
vu_pattern(V, #c_alias{var=Var,pat=P}, St0) ->
case vu_pattern(V, Var, St0) of
{true,_}=St1 -> St1;
@@ -234,6 +236,13 @@ 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)
+ end;
+vu_map_pairs(_, [], St) -> St.
+
-spec vu_var_list(cerl:var_name(), [cerl:c_var()]) -> boolean().
vu_var_list(V, Vs) ->