aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-03-14 09:19:20 +0100
committerBjörn Gustavsson <[email protected]>2017-03-14 09:47:41 +0100
commit608e04fb0bf6f88efce4aa2a5ff3cfc50f07fba0 (patch)
treec41ce869366d74d5668d23a1322c6a3cc1d65687 /lib
parent8a76ad9eccbaf02dd8ada2961a495d2754aeb9b1 (diff)
downloadotp-608e04fb0bf6f88efce4aa2a5ff3cfc50f07fba0.tar.gz
otp-608e04fb0bf6f88efce4aa2a5ff3cfc50f07fba0.tar.bz2
otp-608e04fb0bf6f88efce4aa2a5ff3cfc50f07fba0.zip
Clean up asn1ct_gen:emit/1
Remove blank lines between clauses; use matching instead of is_list/1 guards.
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl22
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index 56ea28d5cf..2e9dbd78da 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -958,42 +958,34 @@ emit(Term) ->
do_emit({prev,Variable}) when is_atom(Variable) ->
do_emit({var,asn1ct_name:prev(Variable)});
-
do_emit({next,Variable}) when is_atom(Variable) ->
do_emit({var,asn1ct_name:next(Variable)});
-
do_emit({curr,Variable}) when is_atom(Variable) ->
do_emit({var,asn1ct_name:curr(Variable)});
-
do_emit({var,Variable}) when is_atom(Variable) ->
[Head|V] = atom_to_list(Variable),
[Head-32|V];
-
do_emit({asis,What}) ->
io_lib:format("~w", [What]);
-
do_emit({call,M,F,A}) ->
MFA = {M,F,length(A)},
asn1ct_func:need(MFA),
[atom_to_list(F),"(",call_args(A, "")|")"];
-
do_emit(nl) ->
"\n";
-
do_emit(com) ->
",";
-
+do_emit([C|_]=Str) when is_integer(C) ->
+ Str;
+do_emit([_|_]=L) ->
+ [do_emit(E) || E <- L];
+do_emit([]) ->
+ [];
do_emit(What) when is_integer(What) ->
integer_to_list(What);
-
-do_emit(What) when is_list(What), is_integer(hd(What)) ->
- What;
-
do_emit(What) when is_atom(What) ->
- atom_to_list(What);
+ atom_to_list(What).
-do_emit(What) when is_list(What) ->
- [do_emit(E) || E <- What].
call_args([A|As], Sep) ->
[Sep,do_emit(A)|call_args(As, ", ")];