aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-09-15 14:25:48 +0200
committerHans Bolinder <[email protected]>2015-09-15 14:25:48 +0200
commit676b4aaf02b5ba4069ec19eff2c0b42074d30fce (patch)
treed6907817794d330611df1ef5a1969fe97ca8116f /lib/test_server/src
parent195393b00e0a5b83526a2bca504fe32edd6dc989 (diff)
parentd16c327bd35493a3687f7e07e2b332d2d18c5bc8 (diff)
downloadotp-676b4aaf02b5ba4069ec19eff2c0b42074d30fce.tar.gz
otp-676b4aaf02b5ba4069ec19eff2c0b42074d30fce.tar.bz2
otp-676b4aaf02b5ba4069ec19eff2c0b42074d30fce.zip
Merge branch 'hb/finish_line_abstraction/OTP-12861'
* hb/finish_line_abstraction/OTP-12861: syntax_tools: Use the erl_anno module a bit more test_server: Fix a bug related to the use of the erl_anno module debugger: Fix a bug related to the use of the erl_anno module stdlib: Remove deprecated functions in erl_parse and erl_scan
Diffstat (limited to 'lib/test_server/src')
-rw-r--r--lib/test_server/src/erl2html2.erl31
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) ->