aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2011-11-08 17:43:13 +0100
committerStavros Aronis <[email protected]>2011-11-18 14:42:56 +0100
commit7fde343786329e7465a53c1d2f36e9436343e387 (patch)
tree66435db8b3bbebfa17b0f9beaa6804c4c2d2ad19
parent191151eca1779da7ccc8244b5dca0891ebf5b62d (diff)
downloadotp-7fde343786329e7465a53c1d2f36e9436343e387.tar.gz
otp-7fde343786329e7465a53c1d2f36e9436343e387.tar.bz2
otp-7fde343786329e7465a53c1d2f36e9436343e387.zip
Add lookup function for callbacks
-rw-r--r--lib/dialyzer/src/dialyzer_plt.erl14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/dialyzer/src/dialyzer_plt.erl b/lib/dialyzer/src/dialyzer_plt.erl
index afa46564dd..206c43e4e2 100644
--- a/lib/dialyzer/src/dialyzer_plt.erl
+++ b/lib/dialyzer/src/dialyzer_plt.erl
@@ -48,6 +48,7 @@
insert_exported_types/2,
lookup/2,
lookup_contract/2,
+ lookup_callbacks/2,
lookup_module/2,
merge_plts/1,
merge_plts_or_report_conflicts/2,
@@ -152,6 +153,19 @@ lookup_contract(#plt{contracts = Contracts},
{M, F, _} = MFA) when is_atom(M), is_atom(F) ->
table_lookup(Contracts, MFA).
+-spec lookup_callbacks(plt(), module()) -> [{mfa(),
+ {{Filename::string(),
+ Line::pos_integer()},
+ #contract{}}}].
+
+lookup_callbacks(#plt{callbacks = Callbacks}, Mod) when is_atom(Mod) ->
+ FunModFilter =
+ fun({M, _F, _A}, _Val) -> M =:= Mod;
+ ( _Key, _Val) -> false
+ end,
+ ModCallbacks = dict:filter(FunModFilter, Callbacks),
+ dict:to_list(ModCallbacks).
+
-spec delete_contract_list(plt(), [mfa()]) -> plt().
delete_contract_list(#plt{contracts = Contracts,