Tcl Source Code

Artifact [b124166892]
Login

Artifact b1241668921b8ebf7c7761f5b001d76863c50dee:

Attachment "correction.patch" to ticket [633204ffff] added by dgp 2003-01-10 04:11:13.
RCS file: /cvsroot/tcl/tcl/generic/tclCompCmds.c,v
retrieving revision 1.36
diff -u -r1.36 tclCompCmds.c
--- generic/tclCompCmds.c	8 Jan 2003 00:34:58 -0000	1.36
+++ generic/tclCompCmds.c	9 Jan 2003 21:02:12 -0000
@@ -2393,7 +2393,7 @@
 {
     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 @@
     }
 
     /*
+     * 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--;