Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 31de103f34f7c41f7f1f915d2ca93151d40b409c 1 parent b06e8f2
@legoscia legoscia authored Richard Carlsson committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/edoc_data.erl
View
5 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 ->
Please sign in to comment.
Something went wrong with that request. Please try again.