aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-05-26 11:05:07 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-05-26 11:05:07 +0200
commit7af3edea8608b3d9d4c3ec7ba20713f4fc7b585c (patch)
treeff0b8e577b4268ca2ad34b682ce16f12c7cd9e27 /lib/compiler/src
parentca57aa51136ef2304f987a328e99946e7ac34b62 (diff)
parent3c95f2613cc7030576f28dae73129dffc1962b96 (diff)
downloadotp-7af3edea8608b3d9d4c3ec7ba20713f4fc7b585c.tar.gz
otp-7af3edea8608b3d9d4c3ec7ba20713f4fc7b585c.tar.bz2
otp-7af3edea8608b3d9d4c3ec7ba20713f4fc7b585c.zip
Merge branch 'maint'
Diffstat (limited to 'lib/compiler/src')
-rw-r--r--lib/compiler/src/cerl.erl20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl
index b7e1f0b70b..9d6768b157 100644
--- a/lib/compiler/src/cerl.erl
+++ b/lib/compiler/src/cerl.erl
@@ -126,9 +126,11 @@
map_es/1,
map_arg/1,
update_c_map/3,
+ c_map/1, is_c_map_empty/1,
ann_c_map/2, ann_c_map/3,
map_pair_op/1,map_pair_key/1,map_pair_val/1,
update_c_map_pair/4,
+ c_map_pair/2,
ann_c_map_pair/4
]).
@@ -1582,9 +1584,20 @@ map_es(#c_map{es = Es}) ->
-spec map_arg(c_map()) -> c_map() | c_literal().
-map_arg(#c_map{arg = M}) ->
+map_arg(#c_map{arg=M}) ->
M.
+-spec c_map([c_map_pair()]) -> c_map().
+
+c_map(Pairs) ->
+ #c_map{es=Pairs}.
+
+-spec is_c_map_empty(c_map() | c_literal()) -> boolean().
+
+is_c_map_empty(#c_map{ es=[] }) -> true;
+is_c_map_empty(#c_literal{val=M}) when is_map(M),map_size(M) =:= 0 -> true;
+is_c_map_empty(_) -> false.
+
-spec ann_c_map([term()], [cerl()]) -> c_map() | c_literal().
ann_c_map(As,Es) ->
@@ -1644,6 +1657,11 @@ map_pair_key(#c_map_pair{key=K}) -> K.
map_pair_val(#c_map_pair{val=V}) -> V.
map_pair_op(#c_map_pair{op=Op}) -> Op.
+-spec c_map_pair(cerl(), cerl()) -> c_map_pair().
+
+c_map_pair(Key,Val) ->
+ #c_map_pair{op=#c_literal{val=assoc},key=Key,val=Val}.
+
-spec ann_c_map_pair([term()], cerl(), cerl(), cerl()) ->
c_map_pair().