diff options
author | Stavros Aronis <[email protected]> | 2012-02-19 22:05:47 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-05-21 15:31:18 +0200 |
commit | b8ab5bc3211fdee28000e2fd35a47dafa2a4316c (patch) | |
tree | e1924f55acd525a5fe3b82c3a52a78fea54c5585 /lib/dialyzer/src/dialyzer_worker.erl | |
parent | 08d6fa6c97be82c4b4a480ec04aa06ae8e781783 (diff) | |
download | otp-b8ab5bc3211fdee28000e2fd35a47dafa2a4316c.tar.gz otp-b8ab5bc3211fdee28000e2fd35a47dafa2a4316c.tar.bz2 otp-b8ab5bc3211fdee28000e2fd35a47dafa2a4316c.zip |
Fix types and specs in Dialyzer
Diffstat (limited to 'lib/dialyzer/src/dialyzer_worker.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_worker.erl | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/lib/dialyzer/src/dialyzer_worker.erl b/lib/dialyzer/src/dialyzer_worker.erl index b24103c5a8..48dae7cb56 100644 --- a/lib/dialyzer/src/dialyzer_worker.erl +++ b/lib/dialyzer/src/dialyzer_worker.erl @@ -20,18 +20,26 @@ -module(dialyzer_worker). --export([launch/3]). +-export([launch/4]). --type worker() :: pid(). +-export_type([worker/0]). + +-type worker() :: pid(). %%opaque + +-type mode() :: dialyzer_coordinator:mode(). +-type coordinator() :: dialyzer_coordinator:coordinator(). +-type servers() :: dialyzer_succ_typings:servers() | + dialyzer_analysis_callgraph:servers(). +-type data() :: dialyzer_succ_typings:scc_data() | + dialyzer_succ_typings:scc_refine_data(). -record(state, { - mode :: dialyzer_coordinator:mode(), + mode :: mode(), job :: mfa_or_funlbl() | file:filename(), + coordinator :: coordinator(), + servers :: servers(), depends_on = [] :: list(), - coordinator :: dialyzer_coordinator:coordinator(), - servers :: dialyzer_typesig:servers() | - dialyzer_analysis_callgraph:servers(), - scc_data :: dialyzer_typesig:scc_data() + scc_data :: data() }). -include("dialyzer.hrl"). @@ -46,14 +54,13 @@ %%-------------------------------------------------------------------- --spec launch(dialyzer_coordinator:mode(), [mfa_or_funlbl()], - dialyzer_typesig:servers()) -> worker(). +-spec launch(mode(), [mfa_or_funlbl()], servers(), coordinator()) -> worker(). -launch(Mode, Job, Servers) -> +launch(Mode, Job, Servers, Coordinator) -> State = #state{mode = Mode, job = Job, servers = Servers, - coordinator = self()}, + coordinator = Coordinator}, InitState = case Mode of X when X =:= 'typesig'; X =:= 'dataflow' -> initializing; @@ -93,9 +100,14 @@ loop(getting_data, State) -> loop(updating, get_data(State)); loop(running, #state{mode = 'compile'} = State) -> ?debug("Compile: ~s\n",[State#state.job]), - {EstimatedSize, Data} = start_compilation(State), - Label = ask_coordinator_for_label(EstimatedSize, State), - Result = continue_compilation(Label, Data), + Result = + case start_compilation(State) of + {ok, EstimatedSize, Data} -> + Label = ask_coordinator_for_label(EstimatedSize, State), + continue_compilation(Label, Data); + {error, _Reason} = Error -> + Error + end, report_to_coordinator(Result, State); loop(running, #state{mode = Mode} = State) when Mode =:= 'typesig'; Mode =:= 'dataflow' -> @@ -160,10 +172,9 @@ do_work(#state{mode = Mode, scc_data = SCCData}) -> dataflow -> dialyzer_succ_typings:refine_one_module(SCCData) end. -report_to_coordinator(NotFixpoint, - #state{job = Job, coordinator = Coordinator}) -> +report_to_coordinator(Result, #state{job = Job, coordinator = Coordinator}) -> ?debug("Done: ~p\n",[Job]), - dialyzer_coordinator:scc_done(Job, NotFixpoint, Coordinator). + dialyzer_coordinator:job_done(Job, Result, Coordinator). start_compilation(#state{job = Job, servers = Servers}) -> dialyzer_analysis_callgraph:start_compilation(Job, Servers). |