Keep user's given name when rebinding variables
The following code:
counter = 1
counter = 2
Is now rewritten internally to:
counter = 1
counter@1 = 2
Which gives us a couple things:
1. Better debugging
2. We can now show warnings for rebound variables not used
Elixir also keeps `_@` prefix to store internal variables
(for example, `_@1`, `_@MODULE`, etc).
Closes #607.
This commit is contained in:
@@ -106,6 +106,11 @@ handle_file_warning(_, File, {Line,erl_lint,{undefined_behaviour,Module}}) ->
|
||||
io:format(file_format(Line, File, Message));
|
||||
|
||||
%% Default behavior
|
||||
handle_file_warning(_, File, {Line,erl_lint,{unused_var,Var}}) ->
|
||||
List = lists:takewhile(fun(X) -> X /= $@ end, atom_to_list(Var)),
|
||||
Message = format_error(erl_lint, { unused_var, list_to_atom(List) }),
|
||||
io:format(file_format(Line, File, Message));
|
||||
|
||||
handle_file_warning(_, File, {Line,Module,Desc}) ->
|
||||
Message = format_error(Module, Desc),
|
||||
io:format(file_format(Line, File, Message)).
|
||||
|
||||
Reference in New Issue
Block a user