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 b5a766ddfe84399546dfddebc4377d89d08dc3f6 @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 b5a766d

Please sign in to comment.