aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src/erl_recomment.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-10-31 09:35:27 +0100
committerBjörn Gustavsson <[email protected]>2015-04-30 12:15:25 +0200
commitd70818e34708114df1d4d16f5512ce584309a292 (patch)
tree7c81aefe758c2d93b0b263566595c7cf37e7e94e /lib/syntax_tools/src/erl_recomment.erl
parentda4deac551456d77378e7c5fcbb9b5b53ae7d4fc (diff)
downloadotp-d70818e34708114df1d4d16f5512ce584309a292.tar.gz
otp-d70818e34708114df1d4d16f5512ce584309a292.tar.bz2
otp-d70818e34708114df1d4d16f5512ce584309a292.zip
syntax_tools: Use module erl_anno
Diffstat (limited to 'lib/syntax_tools/src/erl_recomment.erl')
-rw-r--r--lib/syntax_tools/src/erl_recomment.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/syntax_tools/src/erl_recomment.erl b/lib/syntax_tools/src/erl_recomment.erl
index 7b2f9f7adb..72e1e2d2f5 100644
--- a/lib/syntax_tools/src/erl_recomment.erl
+++ b/lib/syntax_tools/src/erl_recomment.erl
@@ -123,7 +123,6 @@ recomment_forms(Tree, Cs, Insert) ->
form_list ->
Tree1 = erl_syntax:flatten_form_list(Tree),
Node = build_tree(Tree1),
-
%% Here we make a small assumption about the substructure of
%% a `form_list' tree: it has exactly one group of subtrees.
[Node1] = node_subtrees(Node),
@@ -753,7 +752,13 @@ get_line(Node) ->
{_, L, _} when is_integer(L) ->
L;
Pos ->
- exit({bad_position, Pos})
+ try erl_anno:line(Pos) of
+ Line ->
+ Line
+ catch
+ _:_ ->
+ exit({bad_position, Pos})
+ end
end.