We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d41d4f commit 5335c53Copy full SHA for 5335c53
lib/internal/freelist.js
@@ -11,9 +11,15 @@ class FreeList {
11
}
12
13
alloc() {
14
- return this.list.length ?
15
- setIsReused(this.list.pop(), true) :
16
- setIsReused(this.ctor.apply(this, arguments), false);
+ let item;
+ if (this.list.length > 0) {
+ item = this.list.pop();
17
+ item[is_reused_symbol] = true;
18
+ } else {
19
+ item = this.ctor.apply(this, arguments);
20
+ item[is_reused_symbol] = false;
21
+ }
22
+ return item;
23
24
25
free(obj) {
@@ -25,11 +31,6 @@ class FreeList {
31
26
32
27
33
28
-function setIsReused(item, reused) {
29
- item[is_reused_symbol] = reused;
30
- return item;
-}
-
34
module.exports = {
35
FreeList,
36
symbols: {
0 commit comments