Permalink
Browse files

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.
  • Loading branch information...
1 parent 4968de7 commit 715bb8044600ec16ad6ba97de9d033f6a5c06bfe @legoscia legoscia committed with gustehn Jul 25, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 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 ->

0 comments on commit 715bb80

Please sign in to comment.