summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Meadows-Jönsson <eric.meadows.jonsson@gmail.com>2019-06-27 22:42:52 +0200
committerEric Meadows-Jönsson <eric.meadows.jonsson@gmail.com>2019-06-27 22:45:20 +0200
commitb1b227bd705de4a52a3a00f7bb79a82a71bc2511 (patch)
tree408bf85eb55517133448138e94048d8081637c31
parent9bfb1e1879f6caf631ee18c3b0148c384f8720d1 (diff)
downloadelixir-emj/group-pass.tar.gz
Use :elixir_errors.warning_prefix/0emj/group-pass
-rw-r--r--lib/elixir/lib/module/checker.ex9
-rw-r--r--lib/elixir/src/elixir_errors.erl15
2 files changed, 9 insertions, 15 deletions
diff --git a/lib/elixir/lib/module/checker.ex b/lib/elixir/lib/module/checker.ex
index 058f29938..f7a32c0ae 100644
--- a/lib/elixir/lib/module/checker.ex
+++ b/lib/elixir/lib/module/checker.ex
@@ -177,13 +177,6 @@ defmodule Module.Checker do
end
defp print_warning(message) do
- IO.puts(:stderr, [warning_prefix(), message])
- end
-
- defp warning_prefix() do
- case :application.get_env(:elixir, :ansi_enabled) do
- {:ok, true} -> "\e[33mwarning: \e[0m"
- _ -> "warning: "
- end
+ IO.puts(:stderr, [:elixir_errors.warning_prefix(), message])
end
end
diff --git a/lib/elixir/src/elixir_errors.erl b/lib/elixir/src/elixir_errors.erl
index 5e500eeb4..86a7feccf 100644
--- a/lib/elixir/src/elixir_errors.erl
+++ b/lib/elixir/src/elixir_errors.erl
@@ -4,7 +4,7 @@
%% Notice this is also called by the Erlang backend, so we also support
%% the line number to be none (as it may happen in some erlang errors).
-module(elixir_errors).
--export([compile_error/3, compile_error/4,
+-export([compile_error/3, compile_error/4, warning_prefix/0,
form_error/4, form_warn/4, parse_error/4, erl_warn/3, io_warn/4]).
-include("elixir.hrl").
@@ -21,6 +21,13 @@ io_warn(Line, File, LogMessage, PrintMessage) when is_integer(Line) or (Line ==
send_warning(Line, File, LogMessage),
print_warning(PrintMessage).
+-spec warning_prefix() -> binary().
+warning_prefix() ->
+ case application:get_env(elixir, ansi_enabled) of
+ {ok, true} -> <<"\e[33mwarning: \e[0m">>;
+ _ -> <<"warning: ">>
+ end.
+
%% General forms handling.
-spec form_error(list(), binary() | #{file := binary()}, module(), any()) -> no_return().
@@ -126,12 +133,6 @@ parse_erl_term(Term) ->
%% Helpers
-warning_prefix() ->
- case application:get_env(elixir, ansi_enabled) of
- {ok, true} -> <<"\e[33mwarning: \e[0m">>;
- _ -> <<"warning: ">>
- end.
-
print_warning(Message) ->
io:put_chars(standard_error, [warning_prefix(), Message, $\n]),
ok.