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)
commitb1cd450bf53330939e3b7515f282a29383c347a2 (patch)
tree009b2951d6b35992b3b390051eb33290841f333d /generic/tclEnsemble.c
parente89dea9b9b819e7b5ddc8d171127b749e237af35 (diff)
downloadtcl-b1cd450bf53330939e3b7515f282a29383c347a2.zip
tcl-b1cd450bf53330939e3b7515f282a29383c347a2.tar.gz
tcl-b1cd450bf53330939e3b7515f282a29383c347a2.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.
*/