summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-23 23:04:53 +1100
committerGitHub <noreply@github.com>2024-01-23 17:34:53 +0530
commit6238b0a4579539a627d192e0ce2c4a10993aeb8c (patch)
tree32e0afc23890ade44544062deddbb8582595f621 /ext/node
parent01b6e38bafb4c60a281ba7e854a06a1e8b554bb7 (diff)
refactor: port more ops to `ensureFastOps()` (#22046)
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/polyfills/async_hooks.ts11
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);