diff options
author | Stavros Aronis <[email protected]> | 2011-12-09 16:01:58 +0100 |
---|---|---|
committer | Stavros Aronis <[email protected]> | 2012-02-22 13:04:27 +0100 |
commit | a9b23189c41028b8b4e6e417b3f779253f4d3fe3 (patch) | |
tree | a8432584df990cd28310a270777107d10abc97d5 /lib | |
parent | d96a00e8a11e4b42617e140e6a759748961346d1 (diff) | |
download | otp-a9b23189c41028b8b4e6e417b3f779253f4d3fe3.tar.gz otp-a9b23189c41028b8b4e6e417b3f779253f4d3fe3.tar.bz2 otp-a9b23189c41028b8b4e6e417b3f779253f4d3fe3.zip |
Refactor function selection by Dialyzer's codeserver
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dialyzer/src/dialyzer_codeserver.erl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/dialyzer/src/dialyzer_codeserver.erl b/lib/dialyzer/src/dialyzer_codeserver.erl index 13ca65e4dd..f1e87affbd 100644 --- a/lib/dialyzer/src/dialyzer_codeserver.erl +++ b/lib/dialyzer/src/dialyzer_codeserver.erl @@ -292,15 +292,11 @@ table__loop(Cached, Map) -> {NewCached, Ans} = case Cached of {M, Tree} -> - [Val] = [VarFun || {Var, _Fun} = VarFun <- cerl:module_defs(Tree), - cerl:fname_id(Var) =:= F, - cerl:fname_arity(Var) =:= A], + Val = find_fun(F, A, Tree), {Cached, Val}; _ -> Tree = fetch_and_expand(M, Map), - [Val] = [VarFun || {Var, _Fun} = VarFun <- cerl:module_defs(Tree), - cerl:fname_id(Var) =:= F, - cerl:fname_arity(Var) =:= A], + Val = find_fun(F, A, Tree), {{M, Tree}, Val} end, Pid ! {self(), MFA, Ans}, @@ -329,3 +325,12 @@ fetch_and_expand(Mod, Map) -> Msg = "found no module named '" ++ S ++ "' in the analyzed files", exit({error, Msg}) end. + +find_fun(F, A, Tree) -> + Pred = + fun({Var, _Fun}) -> + (cerl:fname_id(Var) =/= F) orelse + (cerl:fname_arity(Var) =/= A) + end, + [Val|_] = lists:dropwhile(Pred, cerl:module_defs(Tree)), + Val. |