aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Carlsson <[email protected]>2012-04-20 16:48:55 +0200
committerFredrik Gustafsson <[email protected]>2012-08-08 10:58:28 +0200
commit93f3ac8b57033237e7d4fc0c6ba0d32217f68668 (patch)
tree363216b262a42f4f28f54724f5cbd1a94299f7f0 /lib
parentf5c4822046d5c5434cd9a28b765ec6764566f17b (diff)
downloadotp-93f3ac8b57033237e7d4fc0c6ba0d32217f68668.tar.gz
otp-93f3ac8b57033237e7d4fc0c6ba0d32217f68668.tar.bz2
otp-93f3ac8b57033237e7d4fc0c6ba0d32217f68668.zip
preserve line numbers when reverting representation
Diffstat (limited to 'lib')
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index eaaafa2c67..67a2b4daa3 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -6491,9 +6491,13 @@ is_literal(T) ->
revert(Node) ->
case is_tree(Node) of
false ->
- %% Just remove any wrapper. `erl_parse' nodes never contain
- %% abstract syntax tree nodes as subtrees.
- unwrap(Node);
+ %% Just remove any wrapper and copy the position. `erl_parse'
+ %% nodes never contain abstract syntax tree nodes as subtrees.
+ case unwrap(Node) of
+ {error, Info} -> {error, setelement(1,Info,get_pos(Node))};
+ {warning, Info} -> {warning, setelement(1,Info,get_pos(Node))};
+ Node1 -> setelement(2,Node1,get_pos(Node))
+ end;
true ->
case is_leaf(Node) of
true ->