diff options
author | Hans Bolinder <[email protected]> | 2016-06-17 13:08:50 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-07-07 08:39:49 +0200 |
commit | b2c521cb163a86b68b6497801e34e181ed1127c1 (patch) | |
tree | 6d4c15f506794f8e476c93f9bc08df6ff9a9d910 /lib/erl_docgen/src | |
parent | ffade10992fd0d529a11df967a221647156b427f (diff) | |
download | otp-b2c521cb163a86b68b6497801e34e181ed1127c1.tar.gz otp-b2c521cb163a86b68b6497801e34e181ed1127c1.tar.bz2 otp-b2c521cb163a86b68b6497801e34e181ed1127c1.zip |
erl_docgen: Correct callback module for creating erlref
Show map fields correctly.
Diffstat (limited to 'lib/erl_docgen/src')
-rw-r--r-- | lib/erl_docgen/src/docgen_edoc_xml_cb.erl | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl index cf3ca544a2..ad84454111 100644 --- a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl +++ b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl @@ -1035,9 +1035,7 @@ t_type([#xmlElement{name = union, content = Es}]) -> t_type([#xmlElement{name = record, content = Es}]) -> t_record(Es); t_type([#xmlElement{name = map, content = Es}]) -> - t_map(Es); -t_type([#xmlElement{name = map_field, content = Es}]) -> - t_map_field(Es). + t_map(Es). t_var(E) -> [get_attrval(name, E)]. @@ -1072,14 +1070,21 @@ t_fun(Es) -> t_record([E|Es]) -> ["#", get_attrval(value, E), "{"++ seq(fun t_field/1, Es) ++"}"]. + t_field(#xmlElement{name=field, content=[Atom,Type]}) -> [get_attrval(value, Atom), "="] ++ t_utype_elem(Type). t_map(Es) -> - ["#{"] ++ seq(fun t_utype_elem/1, Es, ["}"]). - -t_map_field([K,V]) -> - [t_utype_elem(K) ++ " => " ++ t_utype_elem(V)]. + ["#{"] ++ seq(fun t_map_field/1, Es, ["}"]). + +t_map_field(E = #xmlElement{name = map_field, content = [K,V]}) -> + KElem = t_utype_elem(K), + VElem = t_utype_elem(V), + AS = case get_attrval(assoc_type, E) of + "assoc" -> " => "; + "exact" -> " := " + end, + [KElem ++ AS ++ VElem]. t_abstype(Es) -> Name = t_name(get_elem(erlangName, Es)), |