Skip to content

Commit 308b6bc

Browse files
authored
async_hooks: move asyncResource property on bound function to EOL
PR-URL: #58618 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 2eeb65f commit 308b6bc

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

doc/api/deprecations.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,15 +3583,18 @@ In a future version of Node.js, [`message.headers`][],
35833583

35843584
<!-- YAML
35853585
changes:
3586+
- version: REPLACEME
3587+
pr-url: https://github.com/nodejs/node/pull/58618
3588+
description: End-of-Life.
35863589
- version: v20.0.0
35873590
pr-url: https://github.com/nodejs/node/pull/46432
35883591
description: Runtime-deprecation.
35893592
-->
35903593

3591-
Type: Runtime
3594+
Type: End-of-Life
35923595

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

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

lib/async_hooks.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const {
2020
ERR_INVALID_ASYNC_ID,
2121
} = require('internal/errors').codes;
2222
const {
23-
deprecate,
2423
kEmptyObject,
2524
} = require('internal/util');
2625
const {
@@ -247,7 +246,6 @@ class AsyncResource {
247246
} else {
248247
bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);
249248
}
250-
let self = this;
251249
ObjectDefineProperties(bound, {
252250
'length': {
253251
__proto__: null,
@@ -256,17 +254,6 @@ class AsyncResource {
256254
value: fn.length,
257255
writable: false,
258256
},
259-
'asyncResource': {
260-
__proto__: null,
261-
configurable: true,
262-
enumerable: true,
263-
get: deprecate(function() {
264-
return self;
265-
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
266-
set: deprecate(function(val) {
267-
self = val;
268-
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
269-
},
270257
});
271258
return bound;
272259
}

test/parallel/test-asyncresource-bind.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const fn2 = asyncResource.bind((a, b) => {
2525
return executionAsyncId();
2626
});
2727

28-
assert.strictEqual(fn2.asyncResource, asyncResource);
2928
assert.strictEqual(fn2.length, 2);
3029

3130
setImmediate(() => {

0 commit comments

Comments
 (0)