mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
lib: replace every Symbol.for by SymbolFor primordials
PR-URL: https://github.com/nodejs/node/pull/30857 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
1cce00073e
commit
39898a9db4
6 files changed
+12
-6
No files matched your search
+2
-1
@@ -25,6 +25,7 @@ const {
|
||||
ObjectKeys,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
|
||||
const net = require('net');
|
||||
@@ -378,7 +379,7 @@ Server.prototype[EE.captureRejectionSymbol] = function(
|
||||
}
|
||||
break;
|
||||
default:
|
||||
net.Server.prototype[Symbol.for('nodejs.rejection')]
|
||||
net.Server.prototype[SymbolFor('nodejs.rejection')]
|
||||
.call(this, err, event, ...args);
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
@@ -1294,7 +1295,7 @@ Server.prototype[EE.captureRejectionSymbol] = function(
|
||||
sock.destroy(err);
|
||||
break;
|
||||
default:
|
||||
net.Server.prototype[Symbol.for('nodejs.rejection')]
|
||||
net.Server.prototype[SymbolFor('nodejs.rejection')]
|
||||
.call(this, err, event, sock);
|
||||
}
|
||||
};
|
||||
|
||||
+2
-1
@@ -33,8 +33,9 @@ const {
|
||||
ReflectApply,
|
||||
ReflectOwnKeys,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
const kRejection = Symbol.for('nodejs.rejection');
|
||||
const kRejection = SymbolFor('nodejs.rejection');
|
||||
|
||||
let spliceOne;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectKeys,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
|
||||
const messages = new Map();
|
||||
@@ -199,7 +200,7 @@ class SystemError extends Error {
|
||||
return `${this.name} [${this.code}]: ${this.message}`;
|
||||
}
|
||||
|
||||
[Symbol.for('nodejs.util.inspect.custom')](recurseTimes, ctx) {
|
||||
[SymbolFor('nodejs.util.inspect.custom')](recurseTimes, ctx) {
|
||||
return lazyInternalUtilInspect().inspect(this, {
|
||||
...ctx,
|
||||
getters: true,
|
||||
|
||||
@@ -12,6 +12,7 @@ const {
|
||||
ObjectSetPrototypeOf,
|
||||
ReflectConstruct,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
@@ -425,7 +426,7 @@ module.exports = {
|
||||
|
||||
// Symbol used to provide a custom inspect function for an object as an
|
||||
// alternative to using 'inspect'
|
||||
customInspectSymbol: Symbol.for('nodejs.util.inspect.custom'),
|
||||
customInspectSymbol: SymbolFor('nodejs.util.inspect.custom'),
|
||||
|
||||
// Used by the buffer module to capture an internal reference to the
|
||||
// default isEncoding implementation, just in case userland overrides it.
|
||||
|
||||
@@ -8,6 +8,7 @@ const {
|
||||
ObjectCreate,
|
||||
ObjectEntries,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
} = primordials;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
@@ -62,7 +63,7 @@ const kOnCouldNotSerializeErr = Symbol('kOnCouldNotSerializeErr');
|
||||
const kOnErrorMessage = Symbol('kOnErrorMessage');
|
||||
const kParentSideStdio = Symbol('kParentSideStdio');
|
||||
|
||||
const SHARE_ENV = Symbol.for('nodejs.worker_threads.SHARE_ENV');
|
||||
const SHARE_ENV = SymbolFor('nodejs.worker_threads.SHARE_ENV');
|
||||
const debug = require('internal/util/debuglog').debuglog('worker');
|
||||
|
||||
let cwdCounter;
|
||||
|
||||
Reference in new issue
Block a user