diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-05-21 22:23:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-21 20:23:28 +0000 |
commit | 9ec49897766d9c22f6c7bafabdd3e3f3a4b68ab1 (patch) | |
tree | e618fc4b47a720ce2392794a73735c7e28c3ca4c /core/bindings.js | |
parent | addfb0c546f3cd911514591a91a9eef2ce5e3cec (diff) |
refactor(core): set function names for ops in JavaScript (#19208)
This commit ensures that JavaScript functions generated for registered
ops have proper names set up - the function name matches the name
of the op.
A test was added in `core/runtime.rs` that verifies this.
Closes https://github.com/denoland/deno/issues/19206
Diffstat (limited to 'core/bindings.js')
-rw-r--r-- | core/bindings.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/bindings.js b/core/bindings.js index c7d7af30c..21d27a2c3 100644 --- a/core/bindings.js +++ b/core/bindings.js @@ -20,7 +20,7 @@ Deno.__op__registerOp = function (isAsync, op, opName) { return; } core.asyncOps[opName] = op; - core.ops[opName] = function (...args) { + const fn = function (...args) { if (this !== core.ops) { // deno-lint-ignore prefer-primordials throw new Error( @@ -29,6 +29,8 @@ Deno.__op__registerOp = function (isAsync, op, opName) { } return core.asyncStub(opName, args); }; + fn.name = opName; + core.ops[opName] = fn; } else { core.ops[opName] = op; } |