diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclCompCmds.c | 13 |
2 files changed, 13 insertions, 5 deletions
@@ -1,3 +1,8 @@ +2003-01-09 Don Porter <dgp@users.sourceforge.net> + + * generic/tclCompCmds.c (TclCompilerReturnCmd): Corrected off-by-one + problem with recent commit. [Bug 633204] + 2003-01-09 Vince Darley <vincentdarley@users.sourceforge.net> * generic/tclFileName.c: remove unused variable 'macSpecialCase' 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--; |