summaryrefslogtreecommitdiffstats
path: root/generic/tclEnsemble.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-01-11 14:04:33 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-01-11 14:04:33 (GMT)
commitee55e0197be76483334f6d7a338866914984059f (patch)
tree009b2951d6b35992b3b390051eb33290841f333d /generic/tclEnsemble.c
parentd562dc0f601c1e4871dea0129f2e43bfca1fdb0a (diff)
downloadtcl-ee55e0197be76483334f6d7a338866914984059f.zip
tcl-ee55e0197be76483334f6d7a338866914984059f.tar.gz
tcl-ee55e0197be76483334f6d7a338866914984059f.tar.bz2
First attempt at fixing problems caused by [array set] inside [namespace eval],
which caused partial bytecode generation followed by a reject which triggered the issuing of generic ensemble code with an extra push of the variable name at the start (which got the stack depth wrong).
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r--generic/tclEnsemble.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 2753876..835c9ad 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -3056,6 +3056,9 @@ CompileToCompiledCommand(
Tcl_Parse synthetic;
Tcl_Token *tokenPtr;
int result, i;
+ int savedNumCmds = envPtr->numCommands;
+ int savedStackDepth = envPtr->currStackDepth;
+ unsigned savedCodeNext = envPtr->codeNext - envPtr->codeStart;
if (cmdPtr->compileProc == NULL) {
return TCL_ERROR;
@@ -3110,6 +3113,17 @@ CompileToCompiledCommand(
result = cmdPtr->compileProc(interp, &synthetic, cmdPtr, envPtr);
/*
+ * If our target fails to compile, revert the number of commands and the
+ * pointer to the place to issue the next instruction. [Bug 3600328]
+ */
+
+ if (result != TCL_OK) {
+ envPtr->numCommands = savedNumCmds;
+ envPtr->currStackDepth = savedStackDepth;
+ envPtr->codeNext = envPtr->codeStart + savedCodeNext;
+ }
+
+ /*
* Clean up if necessary.
*/