mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
async_hooks: move asyncResource
property on bound function to EOL
PR-URL: https://github.com/nodejs/node/pull/58618 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
2eeb65fa81
commit
308b6bc6de
3 changed files with 6 additions and 17 deletions
|
@ -3583,15 +3583,18 @@ In a future version of Node.js, [`message.headers`][],
|
||||||
|
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
changes:
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/58618
|
||||||
|
description: End-of-Life.
|
||||||
- version: v20.0.0
|
- version: v20.0.0
|
||||||
pr-url: https://github.com/nodejs/node/pull/46432
|
pr-url: https://github.com/nodejs/node/pull/46432
|
||||||
description: Runtime-deprecation.
|
description: Runtime-deprecation.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Type: Runtime
|
Type: End-of-Life
|
||||||
|
|
||||||
In a future version of Node.js, the `asyncResource` property will no longer
|
Older versions of Node.js would add the `asyncResource` when a function is
|
||||||
be added when a function is bound to an `AsyncResource`.
|
bound to an `AsyncResource`. It no longer does.
|
||||||
|
|
||||||
### DEP0173: the `assert.CallTracker` class
|
### DEP0173: the `assert.CallTracker` class
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ const {
|
||||||
ERR_INVALID_ASYNC_ID,
|
ERR_INVALID_ASYNC_ID,
|
||||||
} = require('internal/errors').codes;
|
} = require('internal/errors').codes;
|
||||||
const {
|
const {
|
||||||
deprecate,
|
|
||||||
kEmptyObject,
|
kEmptyObject,
|
||||||
} = require('internal/util');
|
} = require('internal/util');
|
||||||
const {
|
const {
|
||||||
|
@ -247,7 +246,6 @@ class AsyncResource {
|
||||||
} else {
|
} else {
|
||||||
bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);
|
bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);
|
||||||
}
|
}
|
||||||
let self = this;
|
|
||||||
ObjectDefineProperties(bound, {
|
ObjectDefineProperties(bound, {
|
||||||
'length': {
|
'length': {
|
||||||
__proto__: null,
|
__proto__: null,
|
||||||
|
@ -256,17 +254,6 @@ class AsyncResource {
|
||||||
value: fn.length,
|
value: fn.length,
|
||||||
writable: false,
|
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;
|
return bound;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ const fn2 = asyncResource.bind((a, b) => {
|
||||||
return executionAsyncId();
|
return executionAsyncId();
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.strictEqual(fn2.asyncResource, asyncResource);
|
|
||||||
assert.strictEqual(fn2.length, 2);
|
assert.strictEqual(fn2.length, 2);
|
||||||
|
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue