aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
authorAnthony Ramine <[email protected]>2013-05-19 12:27:42 +0200
committerFredrik Gustafsson <[email protected]>2013-05-28 15:27:01 +0200
commit97710082c26749e43ffc99c7334d97a442c83009 (patch)
treeef31e0b9487a5df77446feb13c7aeb834e15c102 /lib/stdlib/src
parent80c02173c9fc1d76ac1b404a05e2706817a4c308 (diff)
downloadotp-97710082c26749e43ffc99c7334d97a442c83009.tar.gz
otp-97710082c26749e43ffc99c7334d97a442c83009.tar.bz2
otp-97710082c26749e43ffc99c7334d97a442c83009.zip
Support callback attributes in erl_pp
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/erl_pp.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/stdlib/src/erl_pp.erl b/lib/stdlib/src/erl_pp.erl
index c0596e5ba6..657cb5d34c 100644
--- a/lib/stdlib/src/erl_pp.erl
+++ b/lib/stdlib/src/erl_pp.erl
@@ -214,7 +214,9 @@ lattribute({attribute,_Line,type,Type}, Opts, _State) ->
lattribute({attribute,_Line,opaque,Type}, Opts, _State) ->
[typeattr(opaque, Type, Opts),leaf(".\n")];
lattribute({attribute,_Line,spec,Arg}, _Opts, _State) ->
- [specattr(Arg),leaf(".\n")];
+ [specattr(spec, Arg),leaf(".\n")];
+lattribute({attribute,_Line,callback,Arg}, _Opts, _State) ->
+ [specattr(callback, Arg),leaf(".\n")];
lattribute({attribute,_Line,Name,Arg}, Opts, State) ->
[lattribute(Name, Arg, Opts, State),leaf(".\n")].
@@ -311,14 +313,14 @@ union_elem(T) ->
tuple_type(Ts, F) ->
{seq,${,$},[$,],ltypes(Ts, F)}.
-specattr({FuncSpec,TypeSpecs}) ->
+specattr(SpecKind, {FuncSpec,TypeSpecs}) ->
Func = case FuncSpec of
{F,_A} ->
format("~w", [F]);
{M,F,_A} ->
format("~w:~w", [M, F])
end,
- {first,leaf("-spec "),
+ {first,leaf(lists:concat(["-", SpecKind, " "])),
{list,[{first,leaf(Func),spec_clauses(TypeSpecs)}]}}.
spec_clauses(TypeSpecs) ->