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 b06e8f2 commit 31de103f34f7c41f7f1f915d2ca93151d40b409c @legoscia legoscia committed with Richard Carlsson Jul 25, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/edoc_data.erl
View
@@ -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 31de103

Please sign in to comment.