diff options
author | Björn Gustavsson <[email protected]> | 2012-05-16 10:49:36 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-01-28 15:56:25 +0100 |
commit | d3ece60d52880fb273da3c4aa07655a0eeddeafb (patch) | |
tree | 57d3035f1bf5162bbcb8e3d37a3a1a1e485f3a0e /lib/compiler/src/core_pp.erl | |
parent | 860171895f5858314abd85f8461568f34e76c427 (diff) | |
download | otp-d3ece60d52880fb273da3c4aa07655a0eeddeafb.tar.gz otp-d3ece60d52880fb273da3c4aa07655a0eeddeafb.tar.bz2 otp-d3ece60d52880fb273da3c4aa07655a0eeddeafb.zip |
Introduce a representation for maps in Core Erlang
Diffstat (limited to 'lib/compiler/src/core_pp.erl')
-rw-r--r-- | lib/compiler/src/core_pp.erl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/compiler/src/core_pp.erl b/lib/compiler/src/core_pp.erl index 1f91a52be3..c8c59b9246 100644 --- a/lib/compiler/src/core_pp.erl +++ b/lib/compiler/src/core_pp.erl @@ -161,6 +161,22 @@ format_1(#c_tuple{es=Es}, Ctxt) -> format_hseq(Es, ",", add_indent(Ctxt, 1), fun format/2), $} ]; +format_1(#c_map{var=#c_var{}=Var,es=Es}, Ctxt) -> + [format_1(Var, Ctxt), + "~{", + format_hseq(Es, ",", add_indent(Ctxt, 1), fun format/2), + "}~" + ]; +format_1(#c_map{es=Es}, Ctxt) -> + ["~{", + format_hseq(Es, ",", add_indent(Ctxt, 1), fun format/2), + "}~" + ]; +format_1(#c_map_pair{key=K,val=V}, Ctxt) -> + ["~<", + format_hseq([K,V], ",", add_indent(Ctxt, 1), fun format/2), + ">" + ]; format_1(#c_cons{hd=H,tl=T}, Ctxt) -> Txt = ["["|format(H, add_indent(Ctxt, 1))], [Txt|format_list_tail(T, add_indent(Ctxt, width(Txt, Ctxt)))]; |