aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/sys_core_fold.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-03-18 12:20:19 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-03-18 12:20:19 +0100
commita4d314a5298d9725fdd1874763e43b33a39252a0 (patch)
tree3beaa441407a6ec335e7bae501443e67a1c9e24e /lib/compiler/src/sys_core_fold.erl
parent8d66a2823c29cbe44cf80e4de0c58f2ed5c29bd4 (diff)
parent5638ca15d05e9b05d64ade0e03492c13d020439b (diff)
downloadotp-a4d314a5298d9725fdd1874763e43b33a39252a0.tar.gz
otp-a4d314a5298d9725fdd1874763e43b33a39252a0.tar.bz2
otp-a4d314a5298d9725fdd1874763e43b33a39252a0.zip
Merge branch 'egil/maps-literals'
* egil/maps-literals: compiler: Transform M#{} to is_map(M) dialyzer: Do not native compile modules with Maps code hipe: Properly identify map() type form terms stdlib: Test Map key linting stdlib: Accept records as Map keys stdlib: Accept Maps as Map keys stdlib: Move map type to proper definition stdlib: Properly lint map key expressions compiler: Change #c_map{var} to #c_map{arg} compiler: Constant fold Maps that are safe compiler: Validate Map src compiler: Support literal maps in cerl_clauses:match/2 compiler: Guard BIF is_map/1 is pure erts: Handle literals in is_map/1 compiler: Change Maps Core Format compiler: Create literal Maps in creation if possible
Diffstat (limited to 'lib/compiler/src/sys_core_fold.erl')
-rw-r--r--lib/compiler/src/sys_core_fold.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 058abd3357..52d6dfe184 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -72,7 +72,7 @@
-import(lists, [map/2,foldl/3,foldr/3,mapfoldl/3,all/2,any/2,
reverse/1,reverse/2,member/2,nth/2,flatten/1,unzip/1]).
--import(cerl, [ann_c_cons/3,ann_c_tuple/2]).
+-import(cerl, [ann_c_cons/3,ann_c_map/3,ann_c_tuple/2]).
-include("core_parse.hrl").
@@ -246,7 +246,7 @@ expr(#c_tuple{anno=Anno,es=Es0}=Tuple, Ctxt, Sub) ->
value ->
ann_c_tuple(Anno, Es)
end;
-expr(#c_map{var=V0,es=Es0}=Map, Ctxt, Sub) ->
+expr(#c_map{anno=Anno,arg=V0,es=Es0}=Map, Ctxt, Sub) ->
Es = pair_list(Es0, Ctxt, Sub),
case Ctxt of
effect ->
@@ -254,7 +254,7 @@ expr(#c_map{var=V0,es=Es0}=Map, Ctxt, Sub) ->
expr(make_effect_seq(Es, Sub), Ctxt, Sub);
value ->
V = expr(V0, Ctxt, Sub),
- Map#c_map{var=V,es=Es}
+ ann_c_map(Anno,V,Es)
end;
expr(#c_binary{segments=Ss}=Bin0, Ctxt, Sub) ->
%% Warn for useless building, but always build the binary
@@ -1378,6 +1378,7 @@ eval_is_record(Call, _, _, _, _) -> Call.
is_not_integer(#c_literal{val=Val}) when not is_integer(Val) -> true;
is_not_integer(#c_tuple{}) -> true;
is_not_integer(#c_cons{}) -> true;
+is_not_integer(#c_map{}) -> true;
is_not_integer(_) -> false.
%% is_not_tuple(Core) -> true | false.
@@ -1385,6 +1386,7 @@ is_not_integer(_) -> false.
is_not_tuple(#c_literal{val=Val}) when not is_tuple(Val) -> true;
is_not_tuple(#c_cons{}) -> true;
+is_not_tuple(#c_map{}) -> true;
is_not_tuple(_) -> false.
%% eval_setelement(Call, Pos, Tuple, NewVal) -> Core.