Implement José's suggestions.

1. Detect all places in elixir_errors:handle_file_warning/3 where we
output something with io
2. Change those places to go through an internal function that will
call elixir_compiler:get_opt and figure out if we should print to
stdout or stderr and act accordingly
3. In the same function above, whenever we print a warning as an error,
we should store somewhere that a warning as an error happened. I
recommend storing that in the elixir_code_server gen server
4. Provide a Code.compilation_status that would return it
This commit is contained in:
Geoffrey Clements
2013-06-09 07:49:38 -04:00
parent 6d98020923
commit 93d5128db3
5 changed files with 37 additions and 9 deletions
+8 -1
View File
@@ -5,11 +5,12 @@
-behavior(gen_server).
-record(elixir_code_server, {
argv=[],
compilation_status=ok,
loaded=[],
at_exit=[],
pool=[],
counter=0,
compiler_options=[{docs,true},{debug_info,true}],
compiler_options=[{docs,true},{debug_info,true},{warnings_as_errors,false}],
waiting=[]
}).
@@ -58,6 +59,9 @@ handle_call(argv, _From, Config) ->
handle_call(compiler_options, _From, Config) ->
{ reply, Config#elixir_code_server.compiler_options, Config };
handle_call(compilation_status, _From, Config) ->
{ reply, Config#elixir_code_server.compilation_status, Config };
handle_call(retrieve_module_name, _From, Config) ->
case Config#elixir_code_server.pool of
[H|T] ->
@@ -80,6 +84,9 @@ handle_cast({ compiler_options, Options }, Config) ->
Final = orddict:merge(fun(_,_,V) -> V end, Config#elixir_code_server.compiler_options, Options),
{ noreply, Config#elixir_code_server{compiler_options=Final} };
handle_cast({ compilation_status, Value }, Config) ->
{ noreply, Config#elixir_code_server{compilation_status=Value} };
handle_cast({ loaded, Path }, Config) ->
Current = Config#elixir_code_server.loaded,
case orddict:find(Path, Current) of