aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/v3_kernel.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-10-01 23:42:17 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-01-28 15:56:28 +0100
commit3c5067eab057391e101845b03c1ba7b76d2b3562 (patch)
treef83b915aa09ce24099c20b97d83d3c24a155b464 /lib/compiler/src/v3_kernel.erl
parent652ddd4c360cd2cc381ed033915d87d967310a49 (diff)
downloadotp-3c5067eab057391e101845b03c1ba7b76d2b3562.tar.gz
otp-3c5067eab057391e101845b03c1ba7b76d2b3562.tar.bz2
otp-3c5067eab057391e101845b03c1ba7b76d2b3562.zip
compiler: Implement support for exact Op in Maps
The syntax is handled upto v3_kernel where it is reduced to previous behaviour for construction and updates. Meaning, the ':=' operator is handled exactly as '=>' operator.
Diffstat (limited to 'lib/compiler/src/v3_kernel.erl')
-rw-r--r--lib/compiler/src/v3_kernel.erl18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl
index f4ba60e529..44f853ec2b 100644
--- a/lib/compiler/src/v3_kernel.erl
+++ b/lib/compiler/src/v3_kernel.erl
@@ -497,12 +497,18 @@ translate_match_fail_1(Anno, As, Sub, #kern{ff=FF}) ->
translate_fc(Args) ->
[#c_literal{val=function_clause},make_list(Args)].
+%% FIXME: Not completed
map_pairs(Es, Sub, St) ->
- foldr(fun(#c_map_pair{key=K0,val=V0}, {Kes,Esp,St0}) ->
- {K,[],St1} = expr(K0, Sub, St0),
- {V,Ep,St2} = atomic(V0, Sub, St1),
- {[#k_map_pair{key=K,val=V}|Kes],Ep ++ Esp,St2}
- end, {[],[],St}, Es).
+ foldr(fun
+ (#c_map_pair_assoc{key=K0,val=V0}, {Kes,Esp,St0}) ->
+ {K,[],St1} = expr(K0, Sub, St0),
+ {V,Ep,St2} = atomic(V0, Sub, St1),
+ {[#k_map_pair{key=K,val=V}|Kes],Ep ++ Esp,St2};
+ (#c_map_pair_exact{key=K0,val=V0}, {Kes,Esp,St0}) ->
+ {K,[],St1} = expr(K0, Sub, St0),
+ {V,Ep,St2} = atomic(V0, Sub, St1),
+ {[#k_map_pair{key=K,val=V}|Kes],Ep ++ Esp,St2}
+ end, {[],[],St}, Es).
%% call_type(Module, Function, Arity) -> call | bif | apply | error.
%% Classify the call.
@@ -662,7 +668,7 @@ pattern(#c_tuple{anno=A,es=Ces}, Isub, Osub0, St0) ->
pattern(#c_map{anno=A,es=Ces}, Isub, Osub0, St0) ->
{Kes,Osub1,St1} = pattern_list(Ces, Isub, Osub0, St0),
{#k_map{anno=A,es=Kes},Osub1,St1};
-pattern(#c_map_pair{anno=A,key=Ck,val=Cv},Isub, Osub0, St0) ->
+pattern(#c_map_pair_exact{anno=A,key=Ck,val=Cv},Isub, Osub0, St0) ->
{Kk,Osub1,St1} = pattern(Ck, Isub, Osub0, St0),
{Kv,Osub2,St2} = pattern(Cv, Isub, Osub1, St1),
{#k_map_pair{anno=A,key=Kk,val=Kv},Osub2,St2};