aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/compile.erl
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2010-05-30 20:02:39 +0300
committerHenrik Nord <[email protected]>2011-10-07 17:08:03 +0200
commit0edb6a4d2d76960846fd04ecce3aa00b3348691b (patch)
tree0838ba0f3a3c744b91e50f5e3bd50738fbfa165b /lib/compiler/src/compile.erl
parent00202339445daae6ed931f28f932089d5c3dd455 (diff)
downloadotp-0edb6a4d2d76960846fd04ecce3aa00b3348691b.tar.gz
otp-0edb6a4d2d76960846fd04ecce3aa00b3348691b.tar.bz2
otp-0edb6a4d2d76960846fd04ecce3aa00b3348691b.zip
Add '-callback' attribute to language syntax
Behaviours may define specs for their callbacks using the familiar spec syntax, replacing the '-spec' keyword with '-callback'. Simple lint checks are performed to ensure that no callbacks are defined twice and all types referred are declared. These attributes can be then used by tools to provide documentation to the behaviour or find discrepancies in the callback definitions in the callback module.
Diffstat (limited to 'lib/compiler/src/compile.erl')
-rw-r--r--lib/compiler/src/compile.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 15849957e7..bfa7c6cedd 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1512,6 +1512,8 @@ restore_expand_module([{attribute,Line,opaque,[Type]}|Fs]) ->
[{attribute,Line,opaque,Type}|restore_expand_module(Fs)];
restore_expand_module([{attribute,Line,spec,[Arg]}|Fs]) ->
[{attribute,Line,spec,Arg}|restore_expand_module(Fs)];
+restore_expand_module([{attribute,Line,callback,[Arg]}|Fs]) ->
+ [{attribute,Line,callback,Arg}|restore_expand_module(Fs)];
restore_expand_module([F|Fs]) ->
[F|restore_expand_module(Fs)];
restore_expand_module([]) -> [].