aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2010-05-06 17:07:33 +0300
committerBjörn Gustavsson <[email protected]>2010-05-06 18:09:47 +0200
commitccf1c5d20bcf76139d4f08a3da0f9954636fea10 (patch)
treeedd449d44b30a7fca16a7e05b25a60cea58242ed
parenta21a9dac550bcb976fa074d7005499a4d6b55791 (diff)
downloadotp-ccf1c5d20bcf76139d4f08a3da0f9954636fea10.tar.gz
otp-ccf1c5d20bcf76139d4f08a3da0f9954636fea10.tar.bz2
otp-ccf1c5d20bcf76139d4f08a3da0f9954636fea10.zip
Fix an erroneous spec
While at it, take out redundant code.
-rw-r--r--lib/syntax_tools/src/erl_comment_scan.erl4
-rw-r--r--lib/syntax_tools/src/erl_prettypr.erl6
-rw-r--r--lib/syntax_tools/src/igor.erl22
3 files changed, 12 insertions, 20 deletions
diff --git a/lib/syntax_tools/src/erl_comment_scan.erl b/lib/syntax_tools/src/erl_comment_scan.erl
index 09ce21a428..e2c6976a2b 100644
--- a/lib/syntax_tools/src/erl_comment_scan.erl
+++ b/lib/syntax_tools/src/erl_comment_scan.erl
@@ -273,12 +273,8 @@ join_lines([], Txt, L, Col, Ind) ->
filename([C|T]) when is_integer(C), C > 0, C =< 255 ->
[C | filename(T)];
-filename([H|T]) ->
- filename(H) ++ filename(T);
filename([]) ->
[];
-filename(N) when is_atom(N) ->
- atom_to_list(N);
filename(N) ->
report_error("bad filename: `~P'.", [N, 25]),
exit(error).
diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl
index 606441bcf1..c2c72d1ed2 100644
--- a/lib/syntax_tools/src/erl_prettypr.erl
+++ b/lib/syntax_tools/src/erl_prettypr.erl
@@ -384,7 +384,7 @@ lay_postcomments(Cs, D) ->
beside(D, floating(break(stack_comments(Cs, true)), 1, 0)).
%% Format (including padding, if `Pad' is `true', otherwise not)
-%% and stack the listed comments above each other,
+%% and stack the listed comments above each other.
stack_comments([C | Cs], Pad) ->
D = stack_comment_lines(erl_syntax:comment_text(C)),
@@ -405,9 +405,7 @@ stack_comments([C | Cs], Pad) ->
D1; % done
_ ->
above(D1, stack_comments(Cs, Pad))
- end;
-stack_comments([], _) ->
- empty().
+ end.
%% Stack lines of text above each other and prefix each string in
%% the list with a single `%' character.
diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl
index e92e9593b6..702b399615 100644
--- a/lib/syntax_tools/src/igor.erl
+++ b/lib/syntax_tools/src/igor.erl
@@ -699,7 +699,7 @@ merge_files(Name, Trees, Files, Opts) ->
options :: [option()]
}).
--spec merge_sources(atom(), erl_syntax:forms(), [option()]) ->
+-spec merge_sources(atom(), [erl_syntax:forms()], [option()]) ->
{erl_syntax:syntaxTree(), [stubDescriptor()]}.
merge_sources(Name, Sources, Opts) ->
@@ -782,12 +782,12 @@ merge_sources_1(Name, Modules, Trees, Opts) ->
%% however not "safe" by default. If no modules are explicitly
%% specified as static, it is assumed that *all* are static.
Static0 = ordsets:from_list(proplists:append_values(static, Opts)),
- case proplists:is_defined(static, Opts) of
- false ->
- Static = All;
- true ->
- Static = ordsets:add_element(Name, Static0)
- end,
+ Static = case proplists:is_defined(static, Opts) of
+ false ->
+ All;
+ true ->
+ ordsets:add_element(Name, Static0)
+ end,
check_module_names(Static, All, "declared 'static'"),
verbose("static modules: ~p.", [Static], Opts),
@@ -806,8 +806,8 @@ merge_sources_1(Name, Modules, Trees, Opts) ->
verbose("safe modules: ~p.", [Safe], Opts),
Preserved = (ordsets:is_element(Name, Sources)
- and ordsets:is_element(Name, Export))
- or proplists:get_bool(no_banner, Opts),
+ andalso ordsets:is_element(Name, Export))
+ orelse proplists:get_bool(no_banner, Opts),
NoHeaders = proplists:get_bool(no_headers, Opts),
Notes = proplists:get_value(notes, Opts, always),
Rs = proplists:append_values(redirect, Opts),
@@ -2924,9 +2924,7 @@ make_attribute({Name, Term}) ->
[erl_syntax:abstract(Term)]).
is_auto_import({F, A}) ->
- erl_internal:bif(F, A);
-is_auto_import(_) ->
- false.
+ erl_internal:bif(F, A).
timestamp() ->
{{Yr, Mth, Dy}, {Hr, Mt, Sc}} = erlang:localtime(),