From 3bc8130a8799cf76ffd3e03e8de53709e3d1898a Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 9 Jan 2003 21:13:20 +0000 Subject: * generic/tclCompCmds.c (TclCompilerReturnCmd): Corrected off-by-one problem with recent commit. [Bug 633204] --- ChangeLog | 5 +++++ generic/tclCompCmds.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 632468b..d482d7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-01-09 Don Porter + + * generic/tclCompCmds.c (TclCompilerReturnCmd): Corrected off-by-one + problem with recent commit. [Bug 633204] + 2003-01-09 Vince Darley * 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--; -- cgit v0.12