aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edoc
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-09-22 17:50:34 +0200
committerBjörn-Egil Dahlberg <[email protected]>2014-09-22 17:50:34 +0200
commitbca562455e1e8cb8be5a5a5de53c926eba51f977 (patch)
tree149a9674f6e42ce9b59f925059b7e98b378e268a /lib/edoc
parent3ef66dd81cd2c21ba201b784f06ac4b5187ea88c (diff)
parent888d5a2004eeb21ac3132e589920f750764ee8c5 (diff)
downloadotp-bca562455e1e8cb8be5a5a5de53c926eba51f977.tar.gz
otp-bca562455e1e8cb8be5a5a5de53c926eba51f977.tar.bz2
otp-bca562455e1e8cb8be5a5a5de53c926eba51f977.zip
Merge branch 'egil/fix-maps-type-pretty-print/OTP-12190' into maint
* egil/fix-maps-type-pretty-print/OTP-12190: edoc, erl_docgen: Enhance internal map type format stdlib: Fix maps type pretty printing
Diffstat (limited to 'lib/edoc')
-rw-r--r--lib/edoc/src/edoc_layout.erl15
-rw-r--r--lib/edoc/src/edoc_types.erl2
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/edoc/src/edoc_layout.erl b/lib/edoc/src/edoc_layout.erl
index f4e78e8f3a..a102d432bc 100644
--- a/lib/edoc/src/edoc_layout.erl
+++ b/lib/edoc/src/edoc_layout.erl
@@ -831,8 +831,6 @@ t_type([#xmlElement{name = nonempty_list, content = Es}]) ->
t_nonempty_list(Es);
t_type([#xmlElement{name = map, content = Es}]) ->
t_map(Es);
-t_type([#xmlElement{name = map_field, content=Es}]) ->
- t_map_field(Es);
t_type([#xmlElement{name = tuple, content = Es}]) ->
t_tuple(Es);
t_type([#xmlElement{name = 'fun', content = Es}]) ->
@@ -882,9 +880,10 @@ t_fun(Es) ->
[") -> "] ++ t_utype(get_elem(type, Es))).
t_map(Es) ->
- ["#{"] ++ seq(fun t_utype_elem/1, Es, ["}"]).
+ Fs = get_elem(map_field, Es),
+ ["#{"] ++ seq(fun t_map_field/1, Fs, ["}"]).
-t_map_field([K,V]) ->
+t_map_field(#xmlElement{content = [K,V]}) ->
t_utype_elem(K) ++ [" => "] ++ t_utype_elem(V).
t_record(E, Es) ->
@@ -1084,8 +1083,6 @@ ot_type([#xmlElement{name = tuple, content = Es}]) ->
ot_tuple(Es);
ot_type([#xmlElement{name = map, content = Es}]) ->
ot_map(Es);
-ot_type([#xmlElement{name = map_field, content = Es}]) ->
- ot_map_field(Es);
ot_type([#xmlElement{name = 'fun', content = Es}]) ->
ot_fun(Es);
ot_type([#xmlElement{name = record, content = Es}]) ->
@@ -1143,10 +1140,10 @@ ot_tuple(Es) ->
{type,0,tuple,[ot_utype_elem(E) || E <- Es]}.
ot_map(Es) ->
- {type,0,map,[ot_utype_elem(E) || E <- Es]}.
+ {type,0,map,[ot_map_field(E) || E <- get_elem(map_field,Es)]}.
-ot_map_field(Es) ->
- {type,0,map_field_assoc,[ot_utype_elem(E) || E <- Es]}.
+ot_map_field(#xmlElement{content=[K,V]}) ->
+ {type,0,map_field_assoc,ot_utype_elem(K), ot_utype_elem(V)}.
ot_fun(Es) ->
Range = ot_utype(get_elem(type, Es)),
diff --git a/lib/edoc/src/edoc_types.erl b/lib/edoc/src/edoc_types.erl
index d4e00d3ecd..8a6c8eb33e 100644
--- a/lib/edoc/src/edoc_types.erl
+++ b/lib/edoc/src/edoc_types.erl
@@ -143,7 +143,7 @@ to_xml(#t_fun{args = As, range = T}, Env) ->
{'fun', [{argtypes, map(fun wrap_utype/2, As, Env)},
wrap_utype(T, Env)]};
to_xml(#t_map{ types = Ts}, Env) ->
- {map, map(fun wrap_utype/2, Ts, Env)};
+ {map, map(fun to_xml/2, Ts, Env)};
to_xml(#t_map_field{ k_type=K, v_type=V}, Env) ->
{map_field, [wrap_utype(K,Env), wrap_utype(V, Env)]};
to_xml(#t_tuple{types = Ts}, Env) ->