Skip to content
Merged
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
9 changes: 6 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -3583,15 +3583,18 @@ In a future version of Node.js, [`message.headers`][],

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/58618
description: End-of-Life.
- version: v20.0.0
pr-url: https://github.com/nodejs/node/pull/46432
description: Runtime-deprecation.
-->

Type: Runtime
Type: End-of-Life

In a future version of Node.js, the `asyncResource` property will no longer
be added when a function is bound to an `AsyncResource`.
Older versions of Node.js would add the `asyncResource` when a function is
bound to an `AsyncResource`. It no longer does.

### DEP0173: the `assert.CallTracker` class

Expand Down
13 changes: 0 additions & 13 deletions lib/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const {
ERR_INVALID_ASYNC_ID,
} = require('internal/errors').codes;
const {
deprecate,
kEmptyObject,
} = require('internal/util');
const {
Expand Down Expand Up @@ -247,7 +246,6 @@ class AsyncResource {
} else {
bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);
}
let self = this;
ObjectDefineProperties(bound, {
'length': {
__proto__: null,
Expand All @@ -256,17 +254,6 @@ class AsyncResource {
value: fn.length,
writable: false,
},
'asyncResource': {
__proto__: null,
configurable: true,
enumerable: true,
get: deprecate(function() {
return self;
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
set: deprecate(function(val) {
self = val;
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
},
});
return bound;
}
Expand Down
1 change: 0 additions & 1 deletion test/parallel/test-asyncresource-bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const fn2 = asyncResource.bind((a, b) => {
return executionAsyncId();
});

assert.strictEqual(fn2.asyncResource, asyncResource);
assert.strictEqual(fn2.length, 2);

setImmediate(() => {
Expand Down
Loading