diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2003-03-19 22:52:48 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2003-03-19 22:52:48 (GMT) |
commit | dc50ee15ae46a3ae3eda860803ae394bc8ddc86b (patch) | |
tree | 5c9d0de7b80f32567b198a8628a7cf5f16dbb901 | |
parent | 16a00586d956341e0f805b7fe688c5362bccd40f (diff) | |
download | tcl-dc50ee15ae46a3ae3eda860803ae394bc8ddc86b.zip tcl-dc50ee15ae46a3ae3eda860803ae394bc8ddc86b.tar.gz tcl-dc50ee15ae46a3ae3eda860803ae394bc8ddc86b.tar.bz2 |
* generic/tclCompile.c:
* tests/compile.test: bad command count on TCL_OUT_LINE_COMPILE
[Bug 705406] (Don Porter). Backport from 8.5a0
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclCompile.c | 11 | ||||
-rw-r--r-- | tests/compile.test | 13 |
3 files changed, 27 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2003-03-19 Miguel Sofer <msofer@users.sf.net> + + * generic/tclCompile.c: + * tests/compile.test: bad command count on TCL_OUT_LINE_COMPILE + [Bug 705406] (Don Porter). + 2003-03-19 Don Porter <dgp@users.sourceforge.net> * doc/Eval.3 (Tcl_EvalObjEx): Corrected CONST and diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 704178b..19f1e25 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.43 2003/02/19 14:33:39 msofer Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.43.2.1 2003/03/19 22:53:11 msofer Exp $ */ #include "tclInt.h" @@ -989,12 +989,19 @@ TclCompileScript(interp, script, numBytes, nested, envPtr) && (cmdPtr->compileProc != NULL) && !(cmdPtr->flags & CMD_HAS_EXEC_TRACES) && !(iPtr->flags & DONT_COMPILE_CMDS_INLINE)) { + int savedNumCmds = envPtr->numCommands; + code = (*(cmdPtr->compileProc))(interp, &parse, envPtr); if (code == TCL_OK) { goto finishCommand; } else if (code == TCL_OUT_LINE_COMPILE) { - /* do nothing */ + /* + * Restore numCommands to its correct value, removing + * any commands compiled before TCL_OUT_LINE_COMPILE + * [Bug 705406] + */ + envPtr->numCommands = savedNumCmds; } else { /* an error */ /* * There was a compilation error, the last diff --git a/tests/compile.test b/tests/compile.test index e31da81..1d2ae72 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.24 2003/01/08 00:34:59 dgp Exp $ +# RCS: @(#) $Id: compile.test,v 1.24.2.1 2003/03/19 22:53:16 msofer Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -115,6 +115,17 @@ test compile-3.4 {TclCompileCatchCmd: bcc'ed [return] is caught} { foo } {2} +test compile-3.5 {TclCompileCatchCmd: recover from error, [Bug 705406]} { + proc foo {} { + catch { + if {[a]} { + if b {} + } + } + } + list [catch foo msg] $msg +} {1 {invalid command name "a"}} + test compile-4.1 {TclCompileForCmd: command substituted test expression} { set i 0 set j 0 |