aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edoc
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2012-07-25 18:04:11 +0100
committerFredrik Gustafsson <[email protected]>2012-08-08 10:01:45 +0200
commit715bb8044600ec16ad6ba97de9d033f6a5c06bfe (patch)
treeeaf84199fd9048d0bd8709229ca79e13f637b507 /lib/edoc
parent4968de7826816b4a9eac94fd8776fe4b7454ca14 (diff)
downloadotp-715bb8044600ec16ad6ba97de9d033f6a5c06bfe.tar.gz
otp-715bb8044600ec16ad6ba97de9d033f6a5c06bfe.tar.bz2
otp-715bb8044600ec16ad6ba97de9d033f6a5c06bfe.zip
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.
Diffstat (limited to 'lib/edoc')
-rw-r--r--lib/edoc/src/edoc_data.erl5
1 files changed, 4 insertions, 1 deletions
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 ->