better error message

This commit is contained in:
Chris Wanstrath 2025-10-29 21:43:44 -07:00
parent 4b2fd61554
commit fa021e3f18

View File

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