diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2002-04-15 17:32:18 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2002-04-15 17:32:18 (GMT) |
commit | c57b1b3f7c6afcd33faa0e7f8451d07435660464 (patch) | |
tree | fa25103bdb29439c30001f21efa3284d3ad7dd6b /generic/tclExecute.c | |
parent | ce15514b339bfae56c6b2c81da04653c4dff772a (diff) | |
download | tcl-c57b1b3f7c6afcd33faa0e7f8451d07435660464.zip tcl-c57b1b3f7c6afcd33faa0e7f8451d07435660464.tar.gz tcl-c57b1b3f7c6afcd33faa0e7f8451d07435660464.tar.bz2 |
made bytecodes check for a catch before returning; the compiled [return] is otherwise non-catchable. [Bug 542588]
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d737299..fd369b2 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.51 2002/03/29 21:01:12 dgp Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.52 2002/04/15 17:32:18 msofer Exp $ */ #include "tclInt.h" @@ -1090,16 +1090,19 @@ TclExecuteByteCode(interp, codePtr) #endif switch (*pc) { case INST_DONE: + if (stackTop <= initStackTop) { + goto abnormalReturn; + } + /* - * Pop the topmost object from the stack, set the interpreter's - * object result to point to it, and return. + * Set the interpreter's object result to point to the + * topmost object from the stack, and check for a possible + * [catch]. The stackTop's level and refCount will be handled + * by "processCatch" or "abnormalReturn". */ - valuePtr = POP_OBJECT(); + + valuePtr = stackPtr[stackTop]; Tcl_SetObjResult(interp, valuePtr); - TclDecrRefCount(valuePtr); - if (stackTop != initStackTop) { - goto abnormalReturn; - } TRACE_WITH_OBJ(("=> return code=%d, result=", result), iPtr->objResultPtr); #ifdef TCL_COMPILE_DEBUG @@ -1107,7 +1110,7 @@ TclExecuteByteCode(interp, codePtr) fprintf(stdout, "\n"); } #endif - goto done; + goto checkForCatch; case INST_PUSH1: #ifdef TCL_COMPILE_DEBUG @@ -4387,7 +4390,6 @@ TclExecuteByteCode(interp, codePtr) * Free the catch stack array if malloc'ed storage was used. */ - done: if (catchStackPtr != catchStackStorage) { ckfree((char *) catchStackPtr); } |