diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-05-30 07:46:52 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-05-30 07:49:22 +1000 |
commit | 5df766d5139a5d74b0ee4449796688af36aeaec9 (patch) | |
tree | c0b67bebf71a3c195431ad23660046fc700d427f | |
parent | 201a1281ecafed4c20ef478588857380a04a8497 (diff) | |
download | jimtcl-5df766d5139a5d74b0ee4449796688af36aeaec9.zip jimtcl-5df766d5139a5d74b0ee4449796688af36aeaec9.tar.gz jimtcl-5df766d5139a5d74b0ee4449796688af36aeaec9.tar.bz2 |
apply: handle the JIM_RETURN return code
The fix for tailcall in 0d5a208e92 meant that a JIM_RETURN return
code from apply was no longer being converted to the appropriate
return code.o
Fixes: #157
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | jim.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -10110,21 +10110,6 @@ tailcall: Jim_SetEmptyResult(interp); if (cmdPtr->isproc) { retcode = JimCallProcedure(interp, cmdPtr, objc, objv); - - /* Handle the JIM_RETURN return code */ - if (retcode == JIM_RETURN) { - if (--interp->returnLevel <= 0) { - retcode = interp->returnCode; - interp->returnCode = JIM_OK; - interp->returnLevel = 0; - } - } - else if (retcode == JIM_ERR) { - interp->addStackTrace++; - Jim_DecrRefCount(interp, interp->errorProc); - interp->errorProc = objv[0]; - Jim_IncrRefCount(interp->errorProc); - } } else { interp->cmdPrivData = cmdPtr->u.native.privData; @@ -10873,6 +10858,21 @@ badargset: interp->framePtr = interp->framePtr->parent; JimFreeCallFrame(interp, callFramePtr, JIM_FCF_REUSE); + /* Handle the JIM_RETURN return code */ + if (retcode == JIM_RETURN) { + if (--interp->returnLevel <= 0) { + retcode = interp->returnCode; + interp->returnCode = JIM_OK; + interp->returnLevel = 0; + } + } + else if (retcode == JIM_ERR) { + interp->addStackTrace++; + Jim_DecrRefCount(interp, interp->errorProc); + interp->errorProc = argv[0]; + Jim_IncrRefCount(interp->errorProc); + } + return retcode; } |