fix problem with indent detection when inserting the __call function

This commit is contained in:
Ulf Norell
2019-03-01 11:08:14 +01:00
parent c2a5ed28cf
commit 20f2a05638
2 changed files with 29 additions and 5 deletions
+8 -3
View File
@@ -68,9 +68,14 @@ decl() ->
modifiers() ->
many(choice([token(stateful), token(public), token(private), token(internal)])).
add_modifiers(Mods, Node) ->
lists:foldl(fun({Mod, _}, X) -> set_ann(Mod, true, X) end,
Node, Mods).
add_modifiers([], Node) -> Node;
add_modifiers(Mods = [Tok | _], Node) ->
%% Set the position to the position of the first modifier. This is
%% important for code transformation tools (like what we do in
%% create_calldata) to be able to get the indentation of the declaration.
set_pos(get_pos(Tok),
lists:foldl(fun({Mod, _}, X) -> set_ann(Mod, true, X) end,
Node, Mods)).
%% -- Type declarations ------------------------------------------------------