From 98ebe5f4ce6d270dda5fdb5a053f74ab483f0b06 Mon Sep 17 00:00:00 2001 From: Richard Elkins Date: Tue, 5 May 2026 10:14:56 -0500 Subject: [PATCH] JACOBIN-896 jj._panic: force a Go runtime panic --- src/gfunction/misc/jj.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gfunction/misc/jj.go b/src/gfunction/misc/jj.go index a7088c48..85229817 100644 --- a/src/gfunction/misc/jj.go +++ b/src/gfunction/misc/jj.go @@ -68,6 +68,12 @@ func Load_jj() { ParamSlots: 0, GFunction: jjGetProgramName, } + + ghelpers.MethodSignatures["jj._panic()V"] = + ghelpers.GMeth{ + ParamSlots: 0, + GFunction: jjPanic, + } } func jjStringifyScalar(ftype string, fvalue any) *object.Object { @@ -376,3 +382,11 @@ func jjGetProgramName([]interface{}) interface{} { str := glob.JacobinName return object.StringObjectFromGoString(str) } + +func jjPanic([]interface{}) interface{} { + trace.Warning("jjPanic: Will cause a Go runtime divide by zero panic") + var zero = 0 + zero = 1 / zero + errMsg := "jjPanic: What??? No splash???" + return ghelpers.GetGErrBlk(excNames.VirtualMachineError, errMsg) +}