Skip to content

Commit

Permalink
lib: replace WeakMap global by the primordials
Browse files Browse the repository at this point in the history
PR-URL: #31158
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
Sebastien-Ahkrin authored and targos committed Jan 14, 2020
1 parent b1550a6 commit 90196b8
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ rules:
message: "Use `const { Reflect } = primordials;` instead of the global."
- name: Symbol
message: "Use `const { Symbol } = primordials;` instead of the global."
- name: WeakMap
message: "Use `const { WeakMap } = primordials;` instead of the global."
no-restricted-syntax:
# Config copied from .eslintrc.js
- error
Expand Down
1 change: 1 addition & 0 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
ReflectOwnKeys,
Symbol,
SymbolHasInstance,
WeakMap,
} = primordials;

const { trace } = internalBinding('trace_events');
Expand Down
1 change: 1 addition & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
ObjectKeys,
Symbol,
SymbolFor,
WeakMap,
} = primordials;

const messages = new Map();
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ObjectDefineProperty,
WeakMap,
} = primordials;

const {
Expand Down
1 change: 1 addition & 0 deletions lib/internal/source_map/source_map_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
ObjectGetOwnPropertyDescriptor,
ObjectPrototypeHasOwnProperty,
MapPrototypeEntries,
WeakMap,
WeakMapPrototypeGet,
uncurryThis,
} = primordials;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/vm/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
ObjectDefineProperty,
SafePromise,
Symbol,
WeakMap,
} = primordials;

const { isContext } = internalBinding('contextify');
Expand Down
2 changes: 2 additions & 0 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const {
Promise,
PromiseRace,
Symbol,
WeakMap,
WeakSet,
} = primordials;

const {
Expand Down

0 comments on commit 90196b8

Please sign in to comment.