slightly better error message

This commit is contained in:
Chris Wanstrath 2025-10-25 20:07:10 -07:00
parent aa8ecb7cf6
commit 286d5ff943

View File

@ -565,7 +565,7 @@ export class VM {
}
if (fn.type !== 'function')
throw new Error('CALL: not a function')
throw new Error(`CALL: ${fn.type} is not a function (${fn.value})`)
if (this.callStack.length > 0)
this.callStack[this.callStack.length - 1]!.isBreakTarget = true
@ -657,7 +657,7 @@ export class VM {
const tailFn = this.stack.pop()!
if (tailFn.type !== 'function')
throw new Error('TAIL_CALL: not a function')
throw new Error(`TAIL_CALL: ${tailFn.type} is not a function (${tailFn.value})`)
this.scope = new Scope(tailFn.parentScope)