Compare commits

..

No commits in common. "0bb0af6c1e62189d7689e9e6811c62c67b10dbf5" and "78923b3eff115d25da098d68aec3707fde70d64c" have entirely different histories.

2 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,9 @@ export class VM {
this.scope = new Scope()
}
registerFunction(name: string, fn: Function) {
registerFunction(name: string, fn: NativeFunction | Function) {
// If it's already a NativeFunction, use it directly
// Otherwise, assume it's a JS function and wrap it
const wrapped = isWrapped(fn) ? fn as NativeFunction : wrapNative(fn)
this.nativeFunctions.set(name, wrapped)
}

View File

@ -128,7 +128,7 @@ test("CALL_NATIVE - function not found", async () => {
const vm = new VM(bytecode)
expect(vm.run()).rejects.toThrow('CALL_NATIVE: function not found: nonexistent')
await expect(vm.run()).rejects.toThrow('CALL_NATIVE: function not found: nonexistent')
})
test("CALL_NATIVE - using result in subsequent operations", async () => {