summaryrefslogtreecommitdiff
path: root/core/01_core.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-10-04 12:34:53 +0200
committerGitHub <noreply@github.com>2021-10-04 12:34:53 +0200
commitea7a63cd5aafcb20374688a2c7918fdc821ab113 (patch)
tree933b4dcad3eca9f2dc6e56c30112ad37220fc668 /core/01_core.js
parent4a1300edde424f134bd2298d8f30ba3ceb159c16 (diff)
refactor(core): split opcall into sync/async (#12312)
Diffstat (limited to 'core/01_core.js')
-rw-r--r--core/01_core.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/01_core.js b/core/01_core.js
index 44267e6fc..5af352340 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -23,7 +23,7 @@
} = window.__bootstrap.primordials;
// Available on start due to bindings.
- const { opcall } = window.Deno.core;
+ const { opcallSync, opcallAsync } = window.Deno.core;
let opsCache = {};
const errorMap = {};
@@ -85,7 +85,7 @@
function syncOpsCache() {
// op id 0 is a special value to retrieve the map of registered ops.
- opsCache = ObjectFreeze(ObjectFromEntries(opcall(0)));
+ opsCache = ObjectFreeze(ObjectFromEntries(opcallSync(0)));
}
function opresolve() {
@@ -125,14 +125,14 @@
function opAsync(opName, arg1 = null, arg2 = null) {
const promiseId = nextPromiseId++;
- const maybeError = opcall(opsCache[opName], promiseId, arg1, arg2);
+ const maybeError = opcallAsync(opsCache[opName], promiseId, arg1, arg2);
// Handle sync error (e.g: error parsing args)
if (maybeError) return unwrapOpResult(maybeError);
return PromisePrototypeThen(setPromise(promiseId), unwrapOpResult);
}
function opSync(opName, arg1 = null, arg2 = null) {
- return unwrapOpResult(opcall(opsCache[opName], null, arg1, arg2));
+ return unwrapOpResult(opcallSync(opsCache[opName], arg1, arg2));
}
function resources() {