aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2011-08-24 14:38:01 +0200
committerRichard Carlsson <[email protected]>2011-09-25 20:31:21 +0200
commit530d3b1c4b242d31fa035a3d3865ced2576ef1bb (patch)
tree53a3a23c433f671afcfec7285fc2615f954a3458 /lib
parent10f76823b8c71ecc84f51bf9f93514d6d25a4a77 (diff)
downloadotp-530d3b1c4b242d31fa035a3d3865ced2576ef1bb.tar.gz
otp-530d3b1c4b242d31fa035a3d3865ced2576ef1bb.tar.bz2
otp-530d3b1c4b242d31fa035a3d3865ced2576ef1bb.zip
Fix macro expansion in comments following Erlang types
Macros in comments following Erlang types were not expanded. An example: -type t() :: integer(). %% This type is used in {@link foo/0}. The link to foo/0 was not created.
Diffstat (limited to 'lib')
-rw-r--r--lib/edoc/src/edoc_extract.erl15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/edoc/src/edoc_extract.erl b/lib/edoc/src/edoc_extract.erl
index bdda09db1c..5a79e127f6 100644
--- a/lib/edoc/src/edoc_extract.erl
+++ b/lib/edoc/src/edoc_extract.erl
@@ -75,7 +75,7 @@ source(Forms, Comments, File, Env, Opts) when is_list(Forms) ->
source(Forms1, Comments, File, Env, Opts);
source(Forms, Comments, File, Env, Opts) ->
Tree = erl_recomment:quick_recomment_forms(Forms, Comments),
- TypeDocs = find_type_docs(Forms, Comments),
+ TypeDocs = find_type_docs(Forms, Comments, Env, File),
source1(Tree, File, Env, Opts, TypeDocs).
%% @spec source(Forms, File::filename(), Env::edoc_env(),
@@ -111,7 +111,7 @@ source(Forms, Comments, File, Env, Opts) ->
source(Forms, File, Env, Opts) when is_list(Forms) ->
source(erl_syntax:form_list(Forms), File, Env, Opts);
source(Tree, File0, Env, Opts) ->
- TypeDocs = find_type_docs(Tree, []),
+ TypeDocs = find_type_docs(Tree, [], Env, File0),
source1(Tree, File0, Env, Opts, TypeDocs).
%% Forms0 and Comments is used for extracting Erlang type documentation.
@@ -635,14 +635,17 @@ file_macros(_Context, Env) ->
%% The same thing using -type:
%% -type t() :: t1(). % Some docs of t/0;
%% Further docs of t/0.
-find_type_docs(Forms0, Comments) ->
+find_type_docs(Forms0, Comments, Env, File) ->
Tree = erl_recomment:recomment_forms(Forms0, Comments),
Forms = preprocess_forms(Tree),
- edoc_specs:docs(Forms, fun find_fun/2).
+ Env1 = add_macro_defs(edoc_macros:std_macros(Env), [], Env),
+ F = fun(C, Line) -> find_fun(C, Line, Env1, File) end,
+ edoc_specs:docs(Forms, F).
-find_fun(C0, Line) ->
+find_fun(C0, Line, Env, File) ->
C1 = comment_text(C0),
Text = lists:append([C#comment.text || C <- C1]),
Comm = #comment{line = Line, text = Text},
[Tag | _] = scan_tags([Comm]),
- Tag.
+ [Tag1] = edoc_macros:expand_tags([Tag], Env, File),
+ Tag1.