aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syntax_tools/src')
-rw-r--r--lib/syntax_tools/src/erl_prettypr.erl39
1 files changed, 5 insertions, 34 deletions
diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl
index 119d375746..f1615b2610 100644
--- a/lib/syntax_tools/src/erl_prettypr.erl
+++ b/lib/syntax_tools/src/erl_prettypr.erl
@@ -1130,13 +1130,14 @@ lay_2(Node, Ctxt) ->
any_size ->
text("map()");
Fs ->
- {Prec, _PrecR} = type_preop_prec('#'),
- Es = lay_map_fields(Fs,
- floating(text(",")),
- reset_prec(Ctxt)),
+ Ctxt1 = reset_prec(Ctxt),
+ Es = seq(Fs,
+ floating(text(",")), Ctxt1,
+ fun lay/2),
D = beside(floating(text("#{")),
beside(par(Es),
floating(text("}")))),
+ {Prec, _PrecR} = type_preop_prec('#'),
maybe_parentheses(D, Prec, Ctxt)
end;
@@ -1400,36 +1401,6 @@ lay_error_info(T, Ctxt) ->
lay_concrete(T, Ctxt) ->
lay(erl_syntax:abstract(T), Ctxt).
-lay_map_fields([H | T], Separator, Ctxt) ->
- case T of
- [] ->
- [case erl_syntax:type(H) of
- map_type_assoc ->
- lay_last_type_assoc(H, Ctxt);
- _ ->
- lay(H, Ctxt)
- end];
- _ ->
- [maybe_append(Separator, lay(H, Ctxt))
- | lay_map_fields(T, Separator, Ctxt)]
- end;
-lay_map_fields([], _, _) ->
- [empty()].
-
-lay_last_type_assoc(Node, Ctxt) ->
- Name = erl_syntax:map_type_assoc_name(Node),
- Value = erl_syntax:map_type_assoc_value(Node),
- IsAny = fun({type,_,any,[]}) -> true;
- %% ({var,_,'_'}) -> true;
- (_) -> false
- end,
- case IsAny(Name) andalso IsAny(Value) of
- true ->
- text("...");
- false ->
- lay_type_assoc(Name, Value, Ctxt)
- end.
-
lay_type_assoc(Name, Value, Ctxt) ->
Ctxt1 = reset_prec(Ctxt),
D1 = lay(Name, Ctxt1),