summaryrefslogtreecommitdiff
path: root/lib/elixir/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/elixir/src')
-rw-r--r--lib/elixir/src/elixir.erl6
-rw-r--r--lib/elixir/src/elixir_errors.erl8
-rw-r--r--lib/elixir/src/elixir_module.erl13
3 files changed, 19 insertions, 8 deletions
diff --git a/lib/elixir/src/elixir.erl b/lib/elixir/src/elixir.erl
index 46bb07d2d..463f544e2 100644
--- a/lib/elixir/src/elixir.erl
+++ b/lib/elixir/src/elixir.erl
@@ -426,7 +426,7 @@ string_to_tokens(String, StartLine, StartColumn, File, Opts) when is_integer(Sta
{ok, _Line, _Column, [], Tokens} ->
{ok, Tokens};
{ok, _Line, _Column, Warnings, Tokens} ->
- (lists:keyfind(emit_warnings, 1, Opts) /= {emit_warnings, false}) andalso
+ (lists:keyfind(warnings, 1, Opts) /= {warnings, false}) andalso
[elixir_errors:erl_warn(L, File, M) || {L, M} <- lists:reverse(Warnings)],
{ok, Tokens};
{error, {Line, Column, {ErrorPrefix, ErrorSuffix}, Token}, _Rest, _Warnings, _SoFar} ->
@@ -486,8 +486,8 @@ to_binary(Atom) when is_atom(Atom) -> atom_to_binary(Atom).
handle_parsing_opts(File, Opts) ->
WarningFile =
- case lists:keyfind(emit_warnings, 1, Opts) of
- {emit_warnings, false} -> nil;
+ case lists:keyfind(warnings, 1, Opts) of
+ {warnings, false} -> nil;
_ -> File
end,
LiteralEncoder =
diff --git a/lib/elixir/src/elixir_errors.erl b/lib/elixir/src/elixir_errors.erl
index 4a907f207..16874a1d6 100644
--- a/lib/elixir/src/elixir_errors.erl
+++ b/lib/elixir/src/elixir_errors.erl
@@ -33,7 +33,7 @@ print_diagnostic(#{severity := Severity, message := Message, stacktrace := Stack
[["\n ", 'Elixir.Exception':format_stacktrace_entry(E)] || E <- Stacktrace]
end,
io:put_chars(standard_error, [prefix(Severity), Message, Location, "\n\n"]),
- ok.
+ Diagnostic.
emit_diagnostic(Severity, Position, File, Message, Stacktrace) ->
Diagnostic = #{
@@ -44,7 +44,11 @@ emit_diagnostic(Severity, Position, File, Message, Stacktrace) ->
stacktrace => Stacktrace
},
- print_diagnostic(Diagnostic),
+ case get(elixir_code_diagnostics) of
+ undefined -> print_diagnostic(Diagnostic);
+ {Tail, true} -> put(elixir_code_diagnostics, {[print_diagnostic(Diagnostic) | Tail], true});
+ {Tail, false} -> put(elixir_code_diagnostics, {[Diagnostic | Tail], false})
+ end,
case get(elixir_compiler_info) of
undefined -> ok;
diff --git a/lib/elixir/src/elixir_module.erl b/lib/elixir/src/elixir_module.erl
index ca4bef4ed..88a66f14a 100644
--- a/lib/elixir/src/elixir_module.erl
+++ b/lib/elixir/src/elixir_module.erl
@@ -506,13 +506,20 @@ beam_location(ModuleAsCharlist) ->
checker_info() ->
case get(elixir_checker_info) of
undefined -> undefined;
- _ -> 'Elixir.Module.ParallelChecker':get()
+ _ ->
+ Log =
+ case erlang:get(elixir_code_diagnostics) of
+ {_, false} -> false;
+ _ -> true
+ end,
+
+ {'Elixir.Module.ParallelChecker':get(), Log}
end.
spawn_parallel_checker(undefined, _Module, _ModuleMap) ->
nil;
-spawn_parallel_checker(CheckerInfo, Module, ModuleMap) ->
- 'Elixir.Module.ParallelChecker':spawn(CheckerInfo, Module, ModuleMap).
+spawn_parallel_checker({CheckerInfo, Log}, Module, ModuleMap) ->
+ 'Elixir.Module.ParallelChecker':spawn(CheckerInfo, Module, ModuleMap, Log).
make_module_available(Module, Binary) ->
case get(elixir_module_binaries) of