summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c261ba9..a188a0b 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.35 2002/11/14 00:56:43 hobbs Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.36 2003/01/08 00:34:58 dgp Exp $
*/
#include "tclInt.h"
@@ -2393,6 +2393,7 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
{
Tcl_Token *varTokenPtr;
int code;
+ int index = envPtr->exceptArrayNext;
/*
* If we're not in a procedure, don't compile.
@@ -2402,6 +2403,19 @@ TclCompileReturnCmd(interp, parsePtr, envPtr)
return TCL_OUT_LINE_COMPILE;
}
+ /*
+ * 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)) {
+ return TCL_OUT_LINE_COMPILE;
+ }
+ index--;
+ }
+
switch (parsePtr->numWords) {
case 1: {
/*