lib: use assignFunctionName util where it makes sense

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64515
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
Antoine du Hamel authored and GitHub committed 2026-07-17 11:00:54 +00:00
1 parent c1bd1c4c7e
commit 5520388f3b
2 files changed
+5 -10

No files matched your search

+2 -3
View File
@@ -3,7 +3,6 @@
const {
ArrayPrototypeMap,
FunctionPrototypeCall,
ObjectDefineProperty,
Symbol,
} = primordials;
@@ -33,6 +32,7 @@ const {
startPerf,
stopPerf,
} = require('internal/perf/observe');
const { assignFunctionName } = require('internal/util');
const kPerfHooksDnsLookupResolveContext = Symbol('kPerfHooksDnsLookupResolveContext');
@@ -82,8 +82,7 @@ function resolver(bindingName) {
}
return req;
}
ObjectDefineProperty(query, 'name', { __proto__: null, value: bindingName });
return query;
return assignFunctionName(bindingName, query);
}
// This is the callback-based resolver. There is another similar
+3 -7
View File
@@ -4,7 +4,6 @@ const {
ArrayPrototypePushApply,
ArrayPrototypeSome,
FunctionPrototypeBind,
ObjectDefineProperty,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
RegExpPrototypeExec,
@@ -13,6 +12,7 @@ const {
const { validatePort } = require('internal/validators');
const permission = require('internal/process/permission');
const { assignFunctionName } = require('internal/util');
const kMinPort = 1024;
const kMaxPort = 65535;
@@ -88,16 +88,12 @@ function wrapConsole(consoleFromNode) {
// then wrap these two methods into one. Native wrapper will preserve
// the original stack.
if (ObjectPrototypeHasOwnProperty(consoleFromNode, key)) {
consoleFromNode[key] = FunctionPrototypeBind(
consoleFromNode[key] = assignFunctionName(key, FunctionPrototypeBind(
consoleCall,
consoleFromNode,
consoleFromVM[key],
consoleFromNode[key],
);
ObjectDefineProperty(consoleFromNode[key], 'name', {
__proto__: null,
value: key,
});
));
} else {
// Add additional console APIs from the inspector
consoleFromNode[key] = consoleFromVM[key];