diff options
author | Hans Bolinder <[email protected]> | 2014-10-31 09:35:27 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-04-30 12:15:25 +0200 |
commit | d70818e34708114df1d4d16f5512ce584309a292 (patch) | |
tree | 7c81aefe758c2d93b0b263566595c7cf37e7e94e /lib/syntax_tools | |
parent | da4deac551456d77378e7c5fcbb9b5b53ae7d4fc (diff) | |
download | otp-d70818e34708114df1d4d16f5512ce584309a292.tar.gz otp-d70818e34708114df1d4d16f5512ce584309a292.tar.bz2 otp-d70818e34708114df1d4d16f5512ce584309a292.zip |
syntax_tools: Use module erl_anno
Diffstat (limited to 'lib/syntax_tools')
-rw-r--r-- | lib/syntax_tools/src/epp_dodger.erl | 2 | ||||
-rw-r--r-- | lib/syntax_tools/src/erl_recomment.erl | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/syntax_tools/src/epp_dodger.erl b/lib/syntax_tools/src/epp_dodger.erl index 3ca7a8197e..39c522fd11 100644 --- a/lib/syntax_tools/src/epp_dodger.erl +++ b/lib/syntax_tools/src/epp_dodger.erl @@ -454,7 +454,7 @@ io_error(L, Desc) -> {L, ?MODULE, Desc}. start_pos([T | _Ts], _L) -> - element(2, T); + erl_anno:line(element(2, T)); start_pos([], L) -> L. 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. |