Skip to content
Permalink
Browse files

lib: replace Symbol global by the primordials Symbol

PR-URL: #30737
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
Sebastien-Ahkrin authored and targos committed Nov 30, 2019
1 parent d1f4936 commit eac3f0adc46c3af0e94d70bb8635440382df7d7f
Showing with 93 additions and 3 deletions.
  1. +2 −0 lib/.eslintrc.yaml
  2. +1 −0 lib/_http_agent.js
  3. +1 −0 lib/_http_common.js
  4. +1 −0 lib/_http_outgoing.js
  5. +1 −0 lib/_http_server.js
  6. +1 −0 lib/_stream_readable.js
  7. +1 −0 lib/_stream_writable.js
  8. +1 −0 lib/_tls_wrap.js
  9. +1 −0 lib/async_hooks.js
  10. +1 −0 lib/buffer.js
  11. +1 −0 lib/domain.js
  12. +1 −0 lib/events.js
  13. +1 −0 lib/inspector.js
  14. +1 −0 lib/internal/async_hooks.js
  15. +1 −0 lib/internal/child_process.js
  16. +1 −0 lib/internal/child_process/serialization.js
  17. +1 −0 lib/internal/console/constructor.js
  18. +1 −0 lib/internal/crypto/hash.js
  19. +1 −0 lib/internal/crypto/keys.js
  20. +4 −0 lib/internal/crypto/util.js
  21. +5 −0 lib/internal/dgram.js
  22. +1 −0 lib/internal/encoding.js
  23. +1 −0 lib/internal/errors.js
  24. +1 −1 lib/internal/freeze_intrinsics.js
  25. +1 −0 lib/internal/fs/dir.js
  26. +1 −0 lib/internal/fs/promises.js
  27. +1 −0 lib/internal/fs/utils.js
  28. +1 −0 lib/internal/fs/watchers.js
  29. +4 −0 lib/internal/http.js
  30. +1 −0 lib/internal/http2/compat.js
  31. +1 −0 lib/internal/http2/core.js
  32. +1 −0 lib/internal/http2/util.js
  33. +4 −0 lib/internal/js_stream_socket.js
  34. +4 −0 lib/internal/net.js
  35. +1 −0 lib/internal/priority_queue.js
  36. +4 −0 lib/internal/repl/utils.js
  37. +1 −0 lib/internal/stream_base_commons.js
  38. +1 −0 lib/internal/streams/async_iterator.js
  39. +4 −0 lib/internal/streams/buffer_list.js
  40. +5 −0 lib/internal/streams/duplexpair.js
  41. +4 −0 lib/internal/streams/from.js
  42. +1 −0 lib/internal/timers.js
  43. +1 −0 lib/internal/trace_events_async_hooks.js
  44. +1 −0 lib/internal/url.js
  45. +2 −0 lib/internal/util.js
  46. +1 −0 lib/internal/util/comparisons.js
  47. +1 −1 lib/internal/vm/module.js
  48. +1 −0 lib/internal/worker.js
  49. +1 −0 lib/internal/worker/io.js
  50. +1 −0 lib/net.js
  51. +1 −0 lib/os.js
  52. +1 −0 lib/perf_hooks.js
  53. +1 −0 lib/readline.js
  54. +1 −0 lib/repl.js
  55. +1 −0 lib/string_decoder.js
  56. +1 −0 lib/trace_events.js
  57. +1 −0 lib/v8.js
  58. +1 −0 lib/vm.js
  59. +3 −1 lib/wasi.js
  60. +1 −0 lib/zlib.js
@@ -23,6 +23,8 @@ rules:
message: "Use `const { Object } = primordials;` instead of the global."
- name: Reflect
message: "Use `const { Reflect } = primordials;` instead of the global."
- name: Symbol
message: "Use `const { Symbol } = primordials;` instead of the global."
no-restricted-syntax:
# Config copied from .eslintrc.js
- error
@@ -25,6 +25,7 @@ const {
ObjectKeys,
ObjectSetPrototypeOf,
ObjectValues,
Symbol,
} = primordials;

const net = require('net');
@@ -23,6 +23,7 @@

const {
MathMin,
Symbol,
} = primordials;
const { setImmediate } = require('timers');

@@ -28,6 +28,7 @@ const {
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const { getDefaultHighWaterMark } = require('internal/streams/state');
@@ -24,6 +24,7 @@
const {
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const net = require('net');
@@ -27,6 +27,7 @@ const {
NumberIsNaN,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

module.exports = Readable;
@@ -29,6 +29,7 @@ const {
Array,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

module.exports = Writable;
@@ -25,6 +25,7 @@ const {
ObjectAssign,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const {
@@ -3,6 +3,7 @@
const {
NumberIsSafeInteger,
ReflectApply,
Symbol,
} = primordials;

const {
@@ -34,6 +34,7 @@ const {
ObjectDefineProperties,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const {
@@ -30,6 +30,7 @@ const {
Array,
ObjectDefineProperty,
ReflectApply,
Symbol,
} = primordials;

const EventEmitter = require('events');
@@ -32,6 +32,7 @@ const {
ObjectKeys,
ReflectApply,
ReflectOwnKeys,
Symbol,
} = primordials;
const kRejection = Symbol.for('nodejs.rejection');

@@ -3,6 +3,7 @@
const {
JSONParse,
JSONStringify,
Symbol,
} = primordials;

const {
@@ -4,6 +4,7 @@ const {
FunctionPrototypeBind,
NumberIsSafeInteger,
ObjectDefineProperty,
Symbol,
} = primordials;

const {
@@ -4,6 +4,7 @@ const {
ArrayIsArray,
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const {
@@ -3,6 +3,7 @@
const {
JSONParse,
JSONStringify,
Symbol,
} = primordials;
const { Buffer } = require('buffer');
const { StringDecoder } = require('string_decoder');
@@ -15,6 +15,7 @@ const {
ObjectPrototypeHasOwnProperty,
ObjectValues,
ReflectOwnKeys,
Symbol,
} = primordials;

const { trace } = internalBinding('trace_events');
@@ -2,6 +2,7 @@

const {
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const {
@@ -2,6 +2,7 @@

const {
ObjectDefineProperty,
Symbol,
} = primordials;

const {
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const {
getCiphers: _getCiphers,
getCurves: _getCurves,
@@ -1,4 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const { codes } = require('internal/errors');
const { UDP } = internalBinding('udp_wrap');
const { guessHandleType } = internalBinding('util');
@@ -7,6 +7,7 @@ const {
ObjectCreate,
ObjectDefineProperties,
ObjectGetOwnPropertyDescriptors,
Symbol,
} = primordials;

const {
@@ -16,6 +16,7 @@ const {
NumberIsInteger,
ObjectDefineProperty,
ObjectKeys,
Symbol,
} = primordials;

const messages = new Map();
@@ -31,7 +31,7 @@ module.exports = function() {
getOwnPropertyDescriptors,
getOwnPropertyNames,
getOwnPropertySymbols,
getPrototypeOf
getPrototypeOf,
} = Object;
const objectHasOwnProperty = Object.prototype.hasOwnProperty;
const { ownKeys } = Reflect;
@@ -2,6 +2,7 @@

const {
ObjectDefineProperty,
Symbol,
} = primordials;

const pathModule = require('path');
@@ -4,6 +4,7 @@ const {
MathMax,
MathMin,
NumberIsSafeInteger,
Symbol,
} = primordials;

const {
@@ -7,6 +7,7 @@ const {
NumberIsFinite,
ObjectSetPrototypeOf,
ReflectOwnKeys,
Symbol,
} = primordials;

const { Buffer } = require('buffer');
@@ -3,6 +3,7 @@
const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const errors = require('internal/errors');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const { setUnrefTimeout } = require('internal/timers');
const { PerformanceEntry, notify } = internalBinding('performance');

@@ -8,6 +8,7 @@ const {
ObjectKeys,
ObjectPrototypeHasOwnProperty,
ReflectGetPrototypeOf,
Symbol,
} = primordials;

const assert = require('internal/assert');
@@ -11,6 +11,7 @@ const {
ObjectDefineProperty,
ObjectPrototypeHasOwnProperty,
ReflectGetPrototypeOf,
Symbol,
} = primordials;

const {
@@ -6,6 +6,7 @@ const {
Number,
ObjectCreate,
ObjectKeys,
Symbol,
} = primordials;

const binding = internalBinding('http2');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const { setImmediate } = require('timers');
const assert = require('internal/assert');
const { Socket } = require('net');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const Buffer = require('buffer').Buffer;
const { writeBuffer } = internalBinding('fs');
const errors = require('internal/errors');
@@ -2,6 +2,7 @@

const {
Array,
Symbol,
} = primordials;

const kCompare = Symbol('compare');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const acorn = require('internal/deps/acorn/acorn/dist/acorn');
const privateMethods =
require('internal/deps/acorn-plugins/acorn-private-methods/index');
@@ -2,6 +2,7 @@

const {
Array,
Symbol,
} = primordials;

const { Buffer } = require('buffer');
@@ -4,6 +4,7 @@ const {
ObjectCreate,
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
Symbol,
} = primordials;

const finished = require('internal/streams/end-of-stream');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const { Buffer } = require('buffer');
const { inspect } = require('internal/util/inspect');

@@ -1,4 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const { Duplex } = require('stream');

const kCallback = Symbol('Callback');
@@ -1,5 +1,9 @@
'use strict';

const {
Symbol,
} = primordials;

const {
ERR_INVALID_ARG_TYPE
} = require('internal/errors').codes;
@@ -77,6 +77,7 @@ const {
MathTrunc,
NumberMIN_SAFE_INTEGER,
ObjectCreate,
Symbol,
} = primordials;

const {
@@ -4,6 +4,7 @@ const {
ObjectKeys,
SafeMap,
SafeSet,
Symbol,
} = primordials;

const { trace } = internalBinding('trace_events');
@@ -11,6 +11,7 @@ const {
ObjectKeys,
ReflectGetOwnPropertyDescriptor,
ReflectOwnKeys,
Symbol,
} = primordials;

const { inspect } = require('internal/util/inspect');
@@ -11,7 +11,9 @@ const {
ObjectGetPrototypeOf,
ObjectSetPrototypeOf,
ReflectConstruct,
Symbol,
} = primordials;

const {
codes: {
ERR_INVALID_ARG_TYPE,
@@ -15,6 +15,7 @@ const {
ObjectPrototypePropertyIsEnumerable,
ObjectPrototypeToString,
StringPrototypeValueOf,
Symbol,
SymbolPrototypeValueOf,
} = primordials;

@@ -5,8 +5,8 @@ const {
ArrayIsArray,
ObjectCreate,
ObjectDefineProperty,
Symbol,
SafePromise,
Symbol,
} = primordials;

const { isContext } = internalBinding('contextify');

0 comments on commit eac3f0a

Please sign in to comment.
You can’t perform that action at this time.