aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl/cerl_prettypr.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2013-11-06 09:01:30 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-28 17:06:41 +0100
commit351987be44e11e6eb9e5841adb197ec8e49bc49d (patch)
treec4661b09df606fbe7d50921651d1ad707150e971 /lib/hipe/cerl/cerl_prettypr.erl
parent72146c6675aaff02b2452c2fd2026c111e641f35 (diff)
downloadotp-351987be44e11e6eb9e5841adb197ec8e49bc49d.tar.gz
otp-351987be44e11e6eb9e5841adb197ec8e49bc49d.tar.bz2
otp-351987be44e11e6eb9e5841adb197ec8e49bc49d.zip
dialyzer,hipe,stdlib: Add Maps understanding to Dialyzer
Diffstat (limited to 'lib/hipe/cerl/cerl_prettypr.erl')
-rw-r--r--lib/hipe/cerl/cerl_prettypr.erl29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/hipe/cerl/cerl_prettypr.erl b/lib/hipe/cerl/cerl_prettypr.erl
index fba9a48cda..60926e16e1 100644
--- a/lib/hipe/cerl/cerl_prettypr.erl
+++ b/lib/hipe/cerl/cerl_prettypr.erl
@@ -62,7 +62,10 @@
receive_action/1, receive_clauses/1, receive_timeout/1,
seq_arg/1, seq_body/1, string_lit/1, try_arg/1,
try_body/1, try_vars/1, try_evars/1, try_handler/1,
- tuple_es/1, type/1, values_es/1, var_name/1]).
+ tuple_es/1, type/1, values_es/1, var_name/1,
+
+ map_es/1, map_pair_assoc_es/1, map_pair_exact_es/1
+ ]).
-define(PAPER, 76).
-define(RIBBON, 45).
@@ -424,6 +427,12 @@ lay_1(Node, Ctxt) ->
lay_cons(Node, Ctxt);
tuple ->
lay_tuple(Node, Ctxt);
+ map ->
+ lay_map(Node, Ctxt);
+ map_pair_assoc ->
+ lay_map_pair_assoc(Node, Ctxt);
+ map_pair_exact ->
+ lay_map_pair_exact(Node, Ctxt);
'let' ->
lay_let(Node, Ctxt);
seq ->
@@ -589,6 +598,24 @@ lay_tuple(Node, Ctxt) ->
Ctxt, fun lay/2)),
floating(text("}")))).
+lay_map(Node, Ctxt) ->
+ beside(floating(text("~{")),
+ beside(par(seq(map_es(Node), floating(text(",")),
+ Ctxt, fun lay/2)),
+ floating(text("}~")))).
+
+lay_map_pair_assoc(Node, Ctxt) ->
+ [K,V] = map_pair_assoc_es(Node),
+ beside(floating(text("::<")),
+ beside(lay(K,Ctxt),beside(floating(text(",")), beside(lay(V,Ctxt),
+ floating(text(">")))))).
+
+lay_map_pair_exact(Node, Ctxt) ->
+ [K,V] = map_pair_exact_es(Node),
+ beside(floating(text("~<")),
+ beside(lay(K,Ctxt),beside(floating(text(",")), beside(lay(V,Ctxt),
+ floating(text(">")))))).
+
lay_let(Node, Ctxt) ->
V = lay_value_list(let_vars(Node), Ctxt),
D1 = par([follow(text("let"),