diff options
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/async_hooks.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/node/polyfills/async_hooks.ts b/ext/node/polyfills/async_hooks.ts index 9240d56c5..f2733e92d 100644 --- a/ext/node/polyfills/async_hooks.ts +++ b/ext/node/polyfills/async_hooks.ts @@ -7,11 +7,12 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials +import { core } from "ext:core/mod.js"; +const { + op_node_is_promise_rejected, +} = core.ensureFastOps(); import { validateFunction } from "ext:deno_node/internal/validators.mjs"; -const { core } = globalThis.__bootstrap; -const { ops } = core; - function assert(cond: boolean) { if (!cond) throw new Error("Assertion failed"); } @@ -57,7 +58,7 @@ function setPromiseHooks() { }; const after = (promise: Promise<unknown>) => { popAsyncFrame(); - if (!ops.op_node_is_promise_rejected(promise)) { + if (!op_node_is_promise_rejected(promise)) { // @ts-ignore promise async context promise[asyncContext] = undefined; } @@ -65,7 +66,7 @@ function setPromiseHooks() { const resolve = (promise: Promise<unknown>) => { const currentFrame = AsyncContextFrame.current(); if ( - !currentFrame.isRoot() && ops.op_node_is_promise_rejected(promise) && + !currentFrame.isRoot() && op_node_is_promise_rejected(promise) && typeof promise[asyncContext] === "undefined" ) { AsyncContextFrame.attachContext(promise); |