Skip to content

Commit

Permalink
lib: replace Map global by the primordials
Browse files Browse the repository at this point in the history
PR-URL: #31155
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Sebastien-Ahkrin authored and targos committed Jan 6, 2020
1 parent f268621 commit 20ecb5d
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ rules:
message: "Use `const { Error } = primordials;` instead of the global." message: "Use `const { Error } = primordials;` instead of the global."
- name: JSON - name: JSON
message: "Use `const { JSON } = primordials;` instead of the global." message: "Use `const { JSON } = primordials;` instead of the global."
- name: Map
message: "Use `const { Map } = primordials;` instead of the global."
- name: Math - name: Math
message: "Use `const { Math } = primordials;` instead of the global." message: "Use `const { Math } = primordials;` instead of the global."
- name: Number - name: Number
Expand Down
1 change: 1 addition & 0 deletions lib/assert.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
ObjectIs, ObjectIs,
ObjectKeys, ObjectKeys,
ObjectPrototypeIsPrototypeOf, ObjectPrototypeIsPrototypeOf,
Map,
RegExpPrototypeTest, RegExpPrototypeTest,
} = primordials; } = primordials;


Expand Down
1 change: 1 addition & 0 deletions lib/domain.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
const { const {
Array, Array,
Error, Error,
Map,
ObjectDefineProperty, ObjectDefineProperty,
ReflectApply, ReflectApply,
Symbol, Symbol,
Expand Down
1 change: 1 addition & 0 deletions lib/fs.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
'use strict'; 'use strict';


const { const {
Map,
MathMax, MathMax,
NumberIsSafeInteger, NumberIsSafeInteger,
ObjectCreate, ObjectCreate,
Expand Down
1 change: 1 addition & 0 deletions lib/inspector.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const { const {
JSONParse, JSONParse,
JSONStringify, JSONStringify,
Map,
Symbol, Symbol,
} = primordials; } = primordials;


Expand Down
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/loaders.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@


const { const {
Error, Error,
ReflectGet, Map,
ObjectCreate, ObjectCreate,
ObjectDefineProperty, ObjectDefineProperty,
ObjectKeys, ObjectKeys,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
ReflectGet,
SafeSet, SafeSet,
} = primordials; } = primordials;


Expand Down
1 change: 1 addition & 0 deletions lib/internal/bootstrap/pre_execution.js
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'; 'use strict';


const { const {
Map,
ObjectDefineProperty, ObjectDefineProperty,
SafeWeakMap, SafeWeakMap,
} = primordials; } = primordials;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/child.js
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'; 'use strict';


const { const {
Map,
ObjectAssign, ObjectAssign,
} = primordials; } = primordials;


Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/master.js
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'; 'use strict';


const { const {
Map,
ObjectKeys, ObjectKeys,
ObjectValues, ObjectValues,
} = primordials; } = primordials;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/cluster/round_robin_handle.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


const { const {
Boolean, Boolean,
Map,
} = primordials; } = primordials;


const assert = require('internal/assert'); const assert = require('internal/assert');
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/cluster/utils.js
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict'; 'use strict';


const {
Map,
} = primordials;

module.exports = { module.exports = {
sendHelper, sendHelper,
internal internal
Expand Down
1 change: 1 addition & 0 deletions lib/internal/console/constructor.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ArrayIsArray, ArrayIsArray,
Boolean, Boolean,
Error, Error,
Map,
MathFloor, MathFloor,
Number, Number,
ObjectDefineProperties, ObjectDefineProperties,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/encoding.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// https://encoding.spec.whatwg.org // https://encoding.spec.whatwg.org


const { const {
Map,
ObjectCreate, ObjectCreate,
ObjectDefineProperties, ObjectDefineProperties,
ObjectGetOwnPropertyDescriptors, ObjectGetOwnPropertyDescriptors,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/errors.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
const { const {
ArrayIsArray, ArrayIsArray,
Error, Error,
Map,
MathAbs, MathAbs,
NumberIsInteger, NumberIsInteger,
ObjectDefineProperty, ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/http2/core.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const { const {
ArrayFrom, ArrayFrom,
ArrayIsArray, ArrayIsArray,
Map,
MathMin, MathMin,
ObjectAssign, ObjectAssign,
ObjectCreate, ObjectCreate,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/modules/cjs/loader.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {
ArrayIsArray, ArrayIsArray,
Error, Error,
JSONParse, JSONParse,
Map,
ObjectCreate, ObjectCreate,
ObjectDefineProperty, ObjectDefineProperty,
ObjectFreeze, ObjectFreeze,
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/process/signal.js
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict'; 'use strict';


const {
Map,
} = primordials;

const { const {
errnoException, errnoException,
} = require('internal/errors'); } = require('internal/errors');
Expand Down
1 change: 1 addition & 0 deletions lib/internal/source_map/source_map_cache.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
ObjectKeys, ObjectKeys,
ObjectGetOwnPropertyDescriptor, ObjectGetOwnPropertyDescriptor,
ObjectPrototypeHasOwnProperty, ObjectPrototypeHasOwnProperty,
Map,
MapPrototypeEntries, MapPrototypeEntries,
WeakMap, WeakMap,
WeakMapPrototypeGet, WeakMapPrototypeGet,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/util.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
ArrayFrom, ArrayFrom,
ArrayIsArray, ArrayIsArray,
Error, Error,
Map,
ObjectCreate, ObjectCreate,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty, ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/util/comparisons.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
BooleanPrototypeValueOf, BooleanPrototypeValueOf,
DatePrototypeGetTime, DatePrototypeGetTime,
Error, Error,
Map,
NumberIsNaN, NumberIsNaN,
NumberPrototypeValueOf, NumberPrototypeValueOf,
ObjectGetOwnPropertySymbols, ObjectGetOwnPropertySymbols,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/util/inspect.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
DatePrototypeToString, DatePrototypeToString,
ErrorPrototypeToString, ErrorPrototypeToString,
JSONStringify, JSONStringify,
Map,
MapPrototype, MapPrototype,
MapPrototypeEntries, MapPrototypeEntries,
MathFloor, MathFloor,
Expand Down
1 change: 1 addition & 0 deletions lib/perf_hooks.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const { const {
ArrayIsArray, ArrayIsArray,
Boolean, Boolean,
Map,
NumberIsSafeInteger, NumberIsSafeInteger,
ObjectDefineProperties, ObjectDefineProperties,
ObjectDefineProperty, ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/v8.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const {
Int16Array, Int16Array,
Int32Array, Int32Array,
Int8Array, Int8Array,
Map,
ObjectPrototypeToString, ObjectPrototypeToString,
Symbol, Symbol,
Uint16Array, Uint16Array,
Expand Down

0 comments on commit 20ecb5d

Please sign in to comment.