summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2003-01-09 21:13:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2003-01-09 21:13:20 (GMT)
commit3bc8130a8799cf76ffd3e03e8de53709e3d1898a (patch)
tree67bae356bcdcfa6a920a80f697ea3bce10f9d053 /generic/tclCompCmds.c
parent148ced9ceeadb0fede7d548f209c3ade2af8291b (diff)
downloadtcl-3bc8130a8799cf76ffd3e03e8de53709e3d1898a.zip
tcl-3bc8130a8799cf76ffd3e03e8de53709e3d1898a.tar.gz
tcl-3bc8130a8799cf76ffd3e03e8de53709e3d1898a.tar.bz2
* generic/tclCompCmds.c (TclCompilerReturnCmd): Corrected off-by-one
problem with recent commit. [Bug 633204]
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index a188a0b..030ca7e 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.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: tclCompCmds.c,v 1.36 2003/01/08 00:34:58 dgp Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.37 2003/01/09 21:13:26 dgp Exp $
*/
#include "tclInt.h"
@@ -2393,7 +2393,7 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
{
Tcl_Token *varTokenPtr;
int code;
- int index = envPtr->exceptArrayNext;
+ int index = envPtr->exceptArrayNext - 1;
/*
* If we're not in a procedure, don't compile.
@@ -2404,13 +2404,16 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
}
/*
+ * Look back through the ExceptionRanges of the current CompileEnv,
+ * from exceptArrayPtr[(exceptArrayNext - 1)] down to
+ * exceptArrayPtr[0] to see if any of them is an enclosing [catch].
* If there's an enclosing [catch], don't compile.
*/
while (index >= 0) {
- ExceptionRange *rangePtr = &(envPtr->exceptArrayPtr[index]);
- if ((rangePtr->type == CATCH_EXCEPTION_RANGE)
- && (rangePtr->catchOffset == -1)) {
+ ExceptionRange range = envPtr->exceptArrayPtr[index];
+ if ((range.type == CATCH_EXCEPTION_RANGE)
+ && (range.catchOffset == -1)) {
return TCL_OUT_LINE_COMPILE;
}
index--;