diff options
author | Hans Bolinder <[email protected]> | 2015-06-30 16:43:02 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2015-09-15 14:15:49 +0200 |
commit | 5ba36a3857eb2673d28fd33ec4655da41ee78d3d (patch) | |
tree | b10039f459057438f60c3a9feb57cbc8c6edd33e | |
parent | 7fd49429e85a1fe2c24b76bd5d3d8dfddc908822 (diff) | |
download | otp-5ba36a3857eb2673d28fd33ec4655da41ee78d3d.tar.gz otp-5ba36a3857eb2673d28fd33ec4655da41ee78d3d.tar.bz2 otp-5ba36a3857eb2673d28fd33ec4655da41ee78d3d.zip |
test_server: Fix a bug related to the use of the erl_anno module
The (harmless) bug was introduced in 42cf8b8.
-rw-r--r-- | lib/test_server/src/erl2html2.erl | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/test_server/src/erl2html2.erl b/lib/test_server/src/erl2html2.erl index 2c63103264..e281c9de1b 100644 --- a/lib/test_server/src/erl2html2.erl +++ b/lib/test_server/src/erl2html2.erl @@ -170,23 +170,32 @@ get_line(Anno) -> %%%----------------------------------------------------------------- %%% Find the line number of the last expression in the function find_clause_lines([{clause,CL,_Params,_Op,Exprs}], CLs) -> % last clause - try tuple_to_list(lists:last(Exprs)) of - [_Type,ExprLine | _] when is_integer(ExprLine) -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)}; - [tree,_ | Exprs1] -> + case classify_exprs(Exprs) of + {anno, Anno} -> + {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(Anno)}; + {tree, Exprs1} -> find_clause_lines([{clause,CL,undefined,undefined,Exprs1}], CLs); - [macro,{_var,ExprLine,_MACRO} | _] when is_integer(ExprLine) -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)}; - _ -> - {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)} - catch - _:_ -> + unknown -> {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)} end; - find_clause_lines([{clause,CL,_Params,_Op,_Exprs} | Cs], CLs) -> find_clause_lines(Cs, [{clause,get_line(CL)}|CLs]). +classify_exprs(Exprs) -> + case tuple_to_list(lists:last(Exprs)) of + [macro,{_var,Anno,_MACRO} | _] -> + {anno, Anno}; + [T,ExprAnno | Exprs1] -> + case erl_anno:is_anno(ExprAnno) of + true -> + {anno, ExprAnno}; + false when T =:= tree -> + {tree, Exprs1}; + false -> + unknown + end + end. + %%%----------------------------------------------------------------- %%% Add a link target for each line and one for each function definition. build_html(SFd,DFd,Encoding,FuncsAndCs) -> |