Tcl Source Code

Artifact [5b69f49d6a]
Login

Artifact 5b69f49d6ac9253e2d299b3c5975c9945e74ef41:

Attachment "exceptDiff4" to ticket [1698093fff] added by msofer 2007-04-11 10:34:17.
Index: generic/tclCompCmds.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompCmds.c,v
retrieving revision 1.107
diff -u -r1.107 tclCompCmds.c
--- generic/tclCompCmds.c	11 Apr 2007 03:18:36 -0000	1.107
+++ generic/tclCompCmds.c	11 Apr 2007 03:33:11 -0000
@@ -107,9 +107,9 @@
 /*
  * Note: the exceptDepth is a bit of a misnomer: TEBC only needs the
  * maximal depth of nested CATCH ranges in order to alloc runtime
- * memory. These macros should compute precisely that? OTOH, the nesting depth
- * of LOOP ranges is an interesting datum for debugging purposes, and that is
- * what we compute now.
+ * memory. These macros should compute precisely that.
+ * OTOH, the nesting depth of LOOP ranges is an interesting datum for
+ * debugging purposes, and that is not computed now.
  *
  * static int	DeclareExceptionRange(CompileEnv *envPtr, int type);
  * static int	ExceptionRangeStarts(CompileEnv *envPtr, int index);
@@ -120,12 +120,14 @@
 #define DeclareExceptionRange(envPtr, type) \
     (TclCreateExceptRange((type), (envPtr)))
 #define ExceptionRangeStarts(envPtr, index) \
-    (((envPtr)->exceptDepth++), \
+    (((envPtr)->exceptDepth += \
+        ((envPtr)->exceptArrayPtr[(index)].type == CATCH_EXCEPTION_RANGE)), \
     ((envPtr)->maxExceptDepth = \
 	    TclMax((envPtr)->exceptDepth, (envPtr)->maxExceptDepth)), \
     ((envPtr)->exceptArrayPtr[(index)].codeOffset = CurrentOffset(envPtr)))
 #define ExceptionRangeEnds(envPtr, index) \
-    (((envPtr)->exceptDepth--), \
+    (((envPtr)->exceptDepth -= \
+        ((envPtr)->exceptArrayPtr[(index)].type == CATCH_EXCEPTION_RANGE)), \
     ((envPtr)->exceptArrayPtr[(index)].numCodeBytes = \
 	CurrentOffset(envPtr) - (envPtr)->exceptArrayPtr[(index)].codeOffset))
 #define ExceptionRangeTarget(envPtr, index, targetType) \