diff options
author | Hans Bolinder <[email protected]> | 2016-06-08 12:14:21 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-06-08 12:43:35 +0200 |
commit | 5e7542d6f7cd1964839f6214915c7f9b7d7f8866 (patch) | |
tree | ba277c79284ef266a220097b45f8ab4a9005c25a /lib/edoc/src/edoc_layout.erl | |
parent | 39c6338a1b671a98cc2c8d21e9ba373816e5071a (diff) | |
download | otp-5e7542d6f7cd1964839f6214915c7f9b7d7f8866.tar.gz otp-5e7542d6f7cd1964839f6214915c7f9b7d7f8866.tar.bz2 otp-5e7542d6f7cd1964839f6214915c7f9b7d7f8866.zip |
edoc: Fix new Maps syntax
Diffstat (limited to 'lib/edoc/src/edoc_layout.erl')
-rw-r--r-- | lib/edoc/src/edoc_layout.erl | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/edoc/src/edoc_layout.erl b/lib/edoc/src/edoc_layout.erl index f723cd8373..e86d090b13 100644 --- a/lib/edoc/src/edoc_layout.erl +++ b/lib/edoc/src/edoc_layout.erl @@ -898,8 +898,20 @@ t_map(Es) -> Fs = get_elem(map_field, Es), ["#{"] ++ seq(fun t_map_field/1, Fs, ["}"]). -t_map_field(#xmlElement{content = [K,V]}) -> - t_utype_elem(K) ++ [" => "] ++ t_utype_elem(V). +t_map_field(#xmlElement{content = [K,V]}=E) -> + KElem = t_utype_elem(K), + VElem = t_utype_elem(V), + AT = get_attrval(assoc_type, E), + IsAny = fun(["any","()"]) -> true; (_) -> false end, + case AT =:= "assoc" andalso IsAny(KElem) andalso IsAny(VElem) of + true -> "..."; + false -> + AS = case AT of + "assoc" -> " => "; + "exact" -> " := " + end, + KElem ++ [AS] ++ VElem + end. t_record(E, Es) -> Name = ["#"] ++ t_type(get_elem(atom, Es)), @@ -1133,8 +1145,12 @@ ot_tuple(Es) -> ot_map(Es) -> {type,0,map,[ot_map_field(E) || E <- get_elem(map_field,Es)]}. -ot_map_field(#xmlElement{content=[K,V]}) -> - {type,0,map_field_assoc,ot_utype_elem(K), ot_utype_elem(V)}. +ot_map_field(#xmlElement{content=[K,V]}=E) -> + A = case get_attrval(assoc_type, E) of + "assoc" -> map_field_assoc; + "exact" -> map_field_exact + end, + {type,0,A,[ot_utype_elem(K), ot_utype_elem(V)]}. ot_fun(Es) -> Range = ot_utype(get_elem(type, Es)), |