summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-05-12 00:42:53 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-05-12 00:42:53 (GMT)
commitd7477a9621b19997f770d8df75b8a071704973d0 (patch)
treef9eb716588b605bb661c61135b0ad0cf6dde8984 /generic/tclCompile.c
parent6b7dccabf9f9804049494bf42d0b72cf5a3f9a90 (diff)
downloadtcl-d7477a9621b19997f770d8df75b8a071704973d0.zip
tcl-d7477a9621b19997f770d8df75b8a071704973d0.tar.gz
tcl-d7477a9621b19997f770d8df75b8a071704973d0.tar.bz2
Corrected the stack balancing in the special [list {*} ] compiler.
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 838d801..7f6b7d4 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -1879,6 +1879,13 @@ TclCompileScript(
if (parsePtr->numWords > 0) {
int expand = 0; /* Set if there are dynamic expansions to
* handle */
+ int expandIgnoredWords = 0;
+ /* The number of *apparent* words that we are
+ * generating code from directly during
+ * expansion processing. For [list {*}blah]
+ * expansion, we set this to one because we
+ * ignore the first word and generate code
+ * directly. */
/*
* If not the first command, pop the previous command's result
@@ -2156,6 +2163,7 @@ TclCompileScript(
*/
expand = INST_LIST_EXPANDED;
+ expandIgnoredWords = 1;
continue;
}
}
@@ -2208,7 +2216,7 @@ TclCompileScript(
*/
TclEmitOpcode(expand, envPtr);
- TclAdjustStackDepth((1-wordIdx), envPtr);
+ TclAdjustStackDepth(1 + expandIgnoredWords - wordIdx, envPtr);
} else if (wordIdx > 0) {
/*
* Save PC -> command map for the TclArgumentBC* functions.