Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: replace every Symbol.for by SymbolFor #30857

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,
SymbolFor,
} = primordials;

const net = require('net');
Expand Down Expand Up @@ -377,7 +378,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);
}
};
Expand Down
3 changes: 2 additions & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
SymbolFor,
} = primordials;

const {
Expand Down Expand Up @@ -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);
}
};
Expand Down
3 changes: 2 additions & 1 deletion lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ const {
ReflectApply,
ReflectOwnKeys,
Symbol,
SymbolFor,
} = primordials;
const kRejection = Symbol.for('nodejs.rejection');
const kRejection = SymbolFor('nodejs.rejection');

let spliceOne;

Expand Down
3 changes: 2 additions & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const {
ObjectDefineProperty,
ObjectKeys,
Symbol,
SymbolFor,
} = primordials;

const messages = new Map();
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const {
ObjectSetPrototypeOf,
ReflectConstruct,
Symbol,
SymbolFor,
} = primordials;

const {
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ObjectCreate,
ObjectEntries,
Symbol,
SymbolFor,
} = primordials;

const EventEmitter = require('events');
Expand Down Expand Up @@ -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;
Expand Down