diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-02-01 18:06:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 18:06:11 +0100 |
commit | 8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch) | |
tree | 94c7d6eb2679e641f59cf78640340f5b7af0022e /ext/ffi/00_ffi.js | |
parent | abf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff) |
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r-- | ext/ffi/00_ffi.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index abe806cc0..b979c73d4 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -5,10 +5,11 @@ const core = window.Deno.core; const __bootstrap = window.__bootstrap; const { - ArrayBuffer, + ArrayBufferPrototype, Uint8Array, BigInt, Number, + ObjectPrototypeIsPrototypeOf, TypeError, } = window.__bootstrap.primordials; @@ -141,6 +142,7 @@ return this.value; } } + const UnsafePointerPrototype = UnsafePointer.prototype; function prepareArgs(types, args) { const parameters = []; @@ -152,12 +154,12 @@ if (type === "pointer") { if ( - arg?.buffer instanceof ArrayBuffer && + ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, arg?.buffer) && arg.byteLength !== undefined ) { parameters.push(buffers.length); buffers.push(arg); - } else if (arg instanceof UnsafePointer) { + } else if (ObjectPrototypeIsPrototypeOf(UnsafePointerPrototype, arg)) { parameters.push(packU64(arg.value)); buffers.push(undefined); } else if (arg === null) { |