Attachment "ex2.patch" to
ticket [483611ffff]
added by
msofer
2001-11-21 19:31:08.
Index: generic/tclCompile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCompile.c,v
retrieving revision 1.28
diff -u -r1.28 tclCompile.c
--- generic/tclCompile.c 2001/11/21 02:36:20 1.28
+++ generic/tclCompile.c 2001/11/21 12:23:52
@@ -1431,13 +1431,14 @@
CompileEnv *envPtr; /* Holds the resulting instructions. */
{
Tcl_Token *wordPtr;
- int maxDepth, range, numBytes, i, code;
+ int maxDepth, currDepth, range, numBytes, i, code;
char *script;
int saveExprIsJustVarRef = envPtr->exprIsJustVarRef;
int saveExprIsComparison = envPtr->exprIsComparison;
envPtr->maxStackDepth = 0;
maxDepth = 0;
+ currDepth = 0;
range = -1;
code = TCL_OK;
@@ -1470,13 +1471,14 @@
if (code != TCL_OK) {
break;
}
+ maxDepth = TclMax(currDepth + envPtr->maxStackDepth, maxDepth);
+ currDepth++;
if (i < (numWords - 1)) {
TclEmitPush(TclRegisterLiteral(envPtr, " ", 1, /*onHeap*/ 0),
envPtr);
- maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);
- } else {
- maxDepth = TclMax(envPtr->maxStackDepth, maxDepth);
+ currDepth++;
}
+ maxDepth = TclMax(currDepth, maxDepth);
wordPtr += (wordPtr->numComponents + 1);
}
if (code == TCL_OK) {