Skip to content

Commit 824b56e

Browse files
committed
Address review
1 parent fae7195 commit 824b56e

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -488,16 +488,16 @@ tokenize([T | Rest], Line, Column, Scope, Tokens) when ?pipe_op(T) ->
488488

489489
% Non-operator Atoms
490490

491-
tokenize([$:, H | T] = Original, Line, Column, Scope, Tokens) when ?is_quote(H) ->
492-
OuterScope = case H == $' of
491+
tokenize([$:, H | T] = Original, Line, Column, BaseScope, Tokens) when ?is_quote(H) ->
492+
Scope = case H == $' of
493493
true ->
494-
prepend_warning(Line, Column, "single quotes around atoms are deprecated. Use double quotes instead.", Scope);
494+
prepend_warning(Line, Column, "single quotes around atoms are deprecated. Use double quotes instead", BaseScope);
495495

496496
false ->
497-
Scope
497+
BaseScope
498498
end,
499499

500-
case elixir_interpolation:extract(Line, Column + 2, OuterScope, true, T, H) of
500+
case elixir_interpolation:extract(Line, Column + 2, Scope, true, T, H) of
501501
{NewLine, NewColumn, Parts, Rest, InterScope} ->
502502
NewScope = case is_unnecessary_quote(Parts, InterScope) of
503503
true ->
@@ -516,7 +516,7 @@ tokenize([$:, H | T] = Original, Line, Column, Scope, Tokens) when ?is_quote(H)
516516

517517
case unescape_tokens(Parts, Line, Column, NewScope) of
518518
{ok, [Part]} when is_binary(Part) ->
519-
case unsafe_to_atom(Part, Line, Column, OuterScope) of
519+
case unsafe_to_atom(Part, Line, Column, Scope) of
520520
{ok, Atom} ->
521521
Token = {atom_quoted, {Line, Column, H}, Atom},
522522
tokenize(Rest, NewLine, NewColumn, NewScope, [Token | Tokens]);
@@ -526,7 +526,7 @@ tokenize([$:, H | T] = Original, Line, Column, Scope, Tokens) when ?is_quote(H)
526526
end;
527527

528528
{ok, Unescaped} ->
529-
Key = case OuterScope#elixir_tokenizer.existing_atoms_only of
529+
Key = case Scope#elixir_tokenizer.existing_atoms_only of
530530
true -> atom_safe;
531531
false -> atom_unsafe
532532
end,
@@ -539,7 +539,7 @@ tokenize([$:, H | T] = Original, Line, Column, Scope, Tokens) when ?is_quote(H)
539539

540540
{error, Reason} ->
541541
Message = " (for atom starting at line ~B)",
542-
interpolation_error(Reason, Original, OuterScope, Tokens, Message, [Line], Line, Column + 1, [H], [H])
542+
interpolation_error(Reason, Original, Scope, Tokens, Message, [Line], Line, Column + 1, [H], [H])
543543
end;
544544

545545
tokenize([$: | String] = Original, Line, Column, Scope, Tokens) ->
@@ -904,16 +904,16 @@ handle_dot([$., $( | Rest], Line, Column, DotInfo, Scope, Tokens) ->
904904
TokensSoFar = add_token_with_eol({dot_call_op, DotInfo, '.'}, Tokens),
905905
tokenize([$( | Rest], Line, Column, Scope, TokensSoFar);
906906

907-
handle_dot([$., H | T] = Original, Line, Column, DotInfo, Scope, Tokens) when ?is_quote(H) ->
908-
OuterScope = case H == $' of
907+
handle_dot([$., H | T] = Original, Line, Column, DotInfo, BaseScope, Tokens) when ?is_quote(H) ->
908+
Scope = case H == $' of
909909
true ->
910-
prepend_warning(Line, Column, "single quotes around calls are deprecated. Use double quotes instead.", Scope);
910+
prepend_warning(Line, Column, "single quotes around calls are deprecated. Use double quotes instead", BaseScope);
911911

912912
false ->
913-
Scope
913+
BaseScope
914914
end,
915915

916-
case elixir_interpolation:extract(Line, Column + 1, OuterScope, true, T, H) of
916+
case elixir_interpolation:extract(Line, Column + 1, Scope, true, T, H) of
917917
{NewLine, NewColumn, [Part], Rest, InterScope} when is_list(Part) ->
918918
NewScope = case is_unnecessary_quote([Part], InterScope) of
919919
true ->
@@ -944,7 +944,7 @@ handle_dot([$., H | T] = Original, Line, Column, DotInfo, Scope, Tokens) when ?i
944944
Message = "interpolation is not allowed when calling function/macro. Found interpolation in a call starting with: ",
945945
error({?LOC(Line, Column), Message, [H]}, Rest, NewScope, Tokens);
946946
{error, Reason} ->
947-
interpolation_error(Reason, Original, OuterScope, Tokens, " (for function name starting at line ~B)", [Line], Line, Column, [H], [H])
947+
interpolation_error(Reason, Original, Scope, Tokens, " (for function name starting at line ~B)", [Line], Line, Column, [H], [H])
948948
end;
949949

950950
handle_dot([$. | Rest], Line, Column, DotInfo, Scope, Tokens) ->

lib/elixir/test/erlang/atom_test.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ atom_with_punctuation_test() ->
1717
{'...', []} = eval(":...").
1818

1919
atom_quoted_call_test() ->
20-
{3, []} = eval("Kernel.'+'(1, 2)").
20+
{3, []} = eval("Kernel.\"+\"(1, 2)").
2121

2222
kv_with_quotes_test() ->
2323
{'foo bar', []} = eval(":atom_test.kv(\"foo bar\": nil)").
@@ -29,7 +29,6 @@ kv_with_interpolation_test() ->
2929

3030
quoted_atom_test() ->
3131
{'+', []} = eval(":\"+\""),
32-
{'+', []} = eval(":'+'"),
3332
{'foo bar', []} = eval(":\"foo bar\"").
3433

3534
atom_with_interpolation_test() ->

0 commit comments

Comments
 (0)