Skip to content

Commit 735296a

Browse files
author
José Valim
committed
Remove elixir_counter in favor of unique_integer
1 parent e34dde7 commit 735296a

File tree

6 files changed

+7
-55
lines changed

6 files changed

+7
-55
lines changed

lib/elixir/lib/macro.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ defmodule Macro do
10981098

10991099
case expand do
11001100
{:ok, receiver, quoted} ->
1101-
next = :elixir_counter.next
1101+
next = :erlang.unique_integer()
11021102
{:elixir_quote.linify_with_context_counter(0, {receiver, next}, quoted), true}
11031103
{:ok, _receiver, _name, _args} ->
11041104
{original, false}
@@ -1119,7 +1119,7 @@ defmodule Macro do
11191119

11201120
case expand do
11211121
{:ok, receiver, quoted} ->
1122-
next = :elixir_counter.next
1122+
next = :erlang.unique_integer()
11231123
{:elixir_quote.linify_with_context_counter(0, {receiver, next}, quoted), true}
11241124
:error ->
11251125
{original, false}

lib/elixir/lib/module.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ defmodule Module do
499499
raise ArgumentError, "expected :file to be given as option"
500500
end
501501

502-
next = :elixir_counter.next
502+
next = :erlang.unique_integer()
503503
line = Keyword.get(opts, :line, 0)
504504
quoted = :elixir_quote.linify_with_context_counter(line, {module, next}, quoted)
505505
:elixir_module.compile(module, quoted, [], :elixir.env_for_eval(opts))

lib/elixir/src/elixir_counter.erl

Lines changed: 0 additions & 38 deletions
This file was deleted.

lib/elixir/src/elixir_dispatch.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ expand_macro_named(Meta, Receiver, Name, Arity, Args, E) ->
202202

203203
expand_quoted(Meta, Receiver, Name, Arity, Quoted, E) ->
204204
Line = ?line(Meta),
205-
Next = elixir_counter:next(),
205+
Next = erlang:unique_integer(),
206206

207207
try
208208
elixir_exp:expand(

lib/elixir/src/elixir_fn.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ handle_capture(false, Meta, Expr, E, Sequential) ->
111111
do_capture(Meta, Expr, E, Sequential).
112112

113113
do_capture(Meta, Expr, E, Sequential) ->
114-
case do_escape(Expr, elixir_counter:next(), E, []) of
114+
case do_escape(Expr, erlang:unique_integer(), E, []) of
115115
{_, []} when not Sequential ->
116116
invalid_capture(Meta, Expr, E);
117117
{EExpr, EDict} ->

lib/elixir/src/elixir_sup.erl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ init(ok) ->
1515
2000, % Shutdown = brutal_kill | int() >= 0 | infinity
1616
worker, % Type = worker | supervisor
1717
[elixir_config] % Modules = [Module] | dynamic
18-
},
18+
},
1919

2020
{
2121
elixir_code_server,
@@ -25,17 +25,7 @@ init(ok) ->
2525
2000, % Shutdown = brutal_kill | int() >= 0 | infinity
2626
worker, % Type = worker | supervisor
2727
[elixir_code_server] % Modules = [Module] | dynamic
28-
},
29-
30-
{
31-
elixir_counter,
32-
{elixir_counter, start_link, []},
33-
34-
permanent, % Restart = permanent | transient | temporary
35-
2000, % Shutdown = brutal_kill | int() >= 0 | infinity
36-
worker, % Type = worker | supervisor
37-
[elixir_counter] % Modules = [Module] | dynamic
38-
}
28+
}
3929
],
4030

4131
{ok, {{one_for_one, 3, 10}, Workers}}.

0 commit comments

Comments
 (0)