diff options
Diffstat (limited to 'interp/interpreter.go')
-rw-r--r-- | interp/interpreter.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/interp/interpreter.go b/interp/interpreter.go index ea5eeaa12..b35129b81 100644 --- a/interp/interpreter.go +++ b/interp/interpreter.go @@ -417,6 +417,10 @@ func (r *runner) run(fn *function, params []value, parentMem *memoryView, indent } else { locals[inst.localIndex] = literalValue{uint8(0)} } + case callFn.name == "__tinygo_interp_raise_test_error": + // Special function that will trigger an error. + // This is used to test error reporting. + return nil, mem, r.errorAt(inst, errors.New("test error")) case strings.HasSuffix(callFn.name, ".$typeassert"): if r.debug { fmt.Fprintln(os.Stderr, indent+"interface assert:", operands[1:]) |