diff options
author | Luca Favatella <[email protected]> | 2015-09-24 23:31:10 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-01-27 08:58:32 +0100 |
commit | 7a2fc5f7ace6f0c3fc03e1f74f6cedf95c7968fd (patch) | |
tree | f86ca2d6463615cb5c7fefcb99f73065ab0a202b /lib/dialyzer/src/dialyzer_worker.erl | |
parent | b33819468f741b608afd03076bf1c14dafaa3887 (diff) | |
download | otp-7a2fc5f7ace6f0c3fc03e1f74f6cedf95c7968fd.tar.gz otp-7a2fc5f7ace6f0c3fc03e1f74f6cedf95c7968fd.tar.bz2 otp-7a2fc5f7ace6f0c3fc03e1f74f6cedf95c7968fd.zip |
Reflect more init-loop OTP pattern in dialyzer_worker
Also clarify in which modes the states `updating` and `waiting` can
happen in the loop.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_worker.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_worker.erl | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/dialyzer/src/dialyzer_worker.erl b/lib/dialyzer/src/dialyzer_worker.erl index 39d88375b8..bae12b21c3 100644 --- a/lib/dialyzer/src/dialyzer_worker.erl +++ b/lib/dialyzer/src/dialyzer_worker.erl @@ -59,16 +59,21 @@ launch(Mode, Job, InitData, Coordinator) -> job = Job, init_data = InitData, coordinator = Coordinator}, - InitState = - case Mode of - X when X =:= 'typesig'; X =:= 'dataflow' -> initializing; - X when X =:= 'compile'; X =:= 'warnings' -> running - end, - spawn_link(fun() -> loop(InitState, State) end). + spawn_link(fun() -> init(State) end). %%-------------------------------------------------------------------- -loop(updating, State) -> +init(#state{job = SCC, mode = Mode, init_data = InitData} = State) when + Mode =:= 'typesig'; Mode =:= 'dataflow' -> + DependsOn = dialyzer_succ_typings:find_depends_on(SCC, InitData), + ?debug("Deps ~p: ~p\n",[SCC, DependsOn]), + loop(updating, State#state{depends_on = DependsOn}); +init(#state{mode = Mode} = State) when + Mode =:= 'compile'; Mode =:= 'warnings' -> + loop(running, State). + +loop(updating, #state{mode = Mode} = State) when + Mode =:= 'typesig'; Mode =:= 'dataflow' -> ?debug("Update: ~p\n",[State#state.job]), NextStatus = case waits_more_success_typings(State) of @@ -76,11 +81,8 @@ loop(updating, State) -> false -> running end, loop(NextStatus, State); -loop(initializing, #state{job = SCC, init_data = InitData} = State) -> - DependsOn = dialyzer_succ_typings:find_depends_on(SCC, InitData), - ?debug("Deps ~p: ~p\n",[State#state.job, DependsOn]), - loop(updating, State#state{depends_on = DependsOn}); -loop(waiting, State) -> +loop(waiting, #state{mode = Mode} = State) when + Mode =:= 'typesig'; Mode =:= 'dataflow' -> ?debug("Wait: ~p\n",[State#state.job]), NewState = wait_for_success_typings(State), loop(updating, NewState); |