aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/src/dialyzer_codeserver.erl
diff options
context:
space:
mode:
authorGustav Simonsson <[email protected]>2012-03-15 10:31:34 +0100
committerGustav Simonsson <[email protected]>2012-03-15 10:31:34 +0100
commitb99ff6a992770ea14506079fd2c656210bc912c9 (patch)
treee9c8653c88b0502dd2246130615baa226d9ba9cc /lib/dialyzer/src/dialyzer_codeserver.erl
parent195a9fe1a07a9aa439e6ea1cd4f7e548267253b4 (diff)
parent3cc9dc31c5935168051286d524618b2b64795498 (diff)
downloadotp-b99ff6a992770ea14506079fd2c656210bc912c9.tar.gz
otp-b99ff6a992770ea14506079fd2c656210bc912c9.tar.bz2
otp-b99ff6a992770ea14506079fd2c656210bc912c9.zip
Merge branch 'sa/dialyzer-fixes' into maint
Diffstat (limited to 'lib/dialyzer/src/dialyzer_codeserver.erl')
-rw-r--r--lib/dialyzer/src/dialyzer_codeserver.erl17
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.