From 715bb8044600ec16ad6ba97de9d033f6a5c06bfe Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Wed, 25 Jul 2012 18:04:11 +0100 Subject: List behaviour callbacks in Edoc when using -callback attribute Defining a behaviour_info/1 function is no longer the only way to define a behaviour; you can use -callback attributes as well. This change makes edoc aware of the latter, such that the module documentation page for a behaviour module will list the name and arity of the required callback functions. Ideally, edoc should use the type information present in the callback attributes, but with this change, the documentation is at least no worse than when using an explicit behaviour_info function. --- lib/edoc/src/edoc_data.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/edoc/src') diff --git a/lib/edoc/src/edoc_data.erl b/lib/edoc/src/edoc_data.erl index aad0b14371..624f9177a2 100644 --- a/lib/edoc/src/edoc_data.erl +++ b/lib/edoc/src/edoc_data.erl @@ -167,7 +167,10 @@ callbacks(Es, Module, Env, Opts) -> case lists:any(fun (#entry{name = {behaviour_info, 1}}) -> true; (_) -> false end, - Es) of + Es) + orelse + lists:keymember(callback, 1, Module#module.attributes) + of true -> try (Module#module.name):behaviour_info(callbacks) of Fs -> -- cgit v1.2.3