js: Implement Value.instanceOf method which performs Js' `instanceof`

check
This commit is contained in:
iddev5 2022-07-07 23:55:32 +05:30 committed by Stephen Gutekanst
parent c587350c71
commit 3b00b478ce
2 changed files with 12 additions and 0 deletions

View file

@ -276,6 +276,13 @@ const zig = {
return val_js === other_js;
},
zigValueInstanceOf(val, other) {
let memory = new MemoryBlock(zig.wasm.exports.memory.buffer);
const val_js = zig.readObject(memory.slice(val), memory);
const other_js = zig.readObject(memory.slice(other), memory);
return val_js instanceof other_js;
},
functionCall(func, this_param, args, args_len, ret_ptr) {
let memory = new MemoryBlock(zig.wasm.exports.memory.buffer);
let argv = [];