aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/cerl.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2015-02-02 12:45:57 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2015-02-12 13:14:38 +0100
commitd5a5df2d00f62ee580156bee605b0c4519f625f1 (patch)
tree2a9cb4160e6779c6cda7814b7636e57ce3d3a5e4 /lib/compiler/src/cerl.erl
parent49b07e561b3658f510ec6ab63cbe35fac24da97e (diff)
downloadotp-d5a5df2d00f62ee580156bee605b0c4519f625f1.tar.gz
otp-d5a5df2d00f62ee580156bee605b0c4519f625f1.tar.bz2
otp-d5a5df2d00f62ee580156bee605b0c4519f625f1.zip
cerl: Add missing is_c_map/1 function
Diffstat (limited to 'lib/compiler/src/cerl.erl')
-rw-r--r--lib/compiler/src/cerl.erl15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/compiler/src/cerl.erl b/lib/compiler/src/cerl.erl
index 1a2957ee31..5d6997da11 100644
--- a/lib/compiler/src/cerl.erl
+++ b/lib/compiler/src/cerl.erl
@@ -124,6 +124,7 @@
%% keep map exports here for now
c_map_pattern/1,
+ is_c_map/1,
map_es/1,
map_arg/1,
update_c_map/3,
@@ -1579,6 +1580,20 @@ ann_make_list(_, [], Node) ->
%% ---------------------------------------------------------------------
%% maps
+%% @spec is_c_map(Node::cerl()) -> boolean()
+%%
+%% @doc Returns <code>true</code> if <code>Node</code> is an abstract
+%% map constructor, otherwise <code>false</code>.
+
+-spec is_c_map(cerl()) -> boolean().
+
+is_c_map(#c_map{}) ->
+ true;
+is_c_map(#c_literal{val = V}) when is_map(V) ->
+ true;
+is_c_map(_) ->
+ false.
+
-spec map_es(c_map()) -> [c_map_pair()].
map_es(#c_map{es = Es}) ->