diff options
author | dgp <dgp@users.sourceforge.net> | 2005-03-18 16:33:32 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-03-18 16:33:32 (GMT) |
commit | 38aa6b01bae64c7dfadc6191237627723343a0a3 (patch) | |
tree | 7baf6484b4775badabfc961d085c528deeecf945 /generic/tclBasic.c | |
parent | 5a484df86936621e5bf60c2a78ab5832ed886485 (diff) | |
download | tcl-38aa6b01bae64c7dfadc6191237627723343a0a3.zip tcl-38aa6b01bae64c7dfadc6191237627723343a0a3.tar.gz tcl-38aa6b01bae64c7dfadc6191237627723343a0a3.tar.bz2 |
* generic/tclBasic.c (Tcl_EvalEx,TclEvalTokensStandard):
* generic/tclCmdMZ.c (Tcl_SubstObj):
* tests/basic.test (basic-46.4): Restored recursion limit
* tests/parse.test (parse-19.*): testing in nested command
substitutions within direct script evaluation (Tcl_EvalEx)
that got lost in the parser reforms of Tcl 8.1. Added tests for
correct behavior. [Bug 1115904]
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f61fc6a..dfa24e8 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.75.2.13 2005/02/10 19:03:59 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.75.2.14 2005/03/18 16:33:41 dgp Exp $ */ #include "tclInt.h" @@ -3405,14 +3405,21 @@ Tcl_EvalTokensStandard(interp, tokenPtr, count) p = buffer; break; - case TCL_TOKEN_COMMAND: - code = Tcl_EvalEx(interp, tokenPtr->start+1, tokenPtr->size-2, - 0); + case TCL_TOKEN_COMMAND: { + Interp *iPtr = (Interp *) interp; + iPtr->numLevels++; + code = TclInterpReady(interp); + if (code == TCL_OK) { + code = Tcl_EvalEx(interp, + tokenPtr->start+1, tokenPtr->size-2, 0); + } + iPtr->numLevels--; if (code != TCL_OK) { goto done; } valuePtr = Tcl_GetObjResult(interp); break; + } case TCL_TOKEN_VARIABLE: if (tokenPtr->numComponents == 1) { @@ -3683,16 +3690,6 @@ Tcl_EvalEx(interp, script, numBytes, flags) parse.commandStart, parse.commandSize, 0); iPtr->numLevels--; if (code != TCL_OK) { - if (iPtr->numLevels == 0) { - if (code == TCL_RETURN) { - code = TclUpdateReturnInfo(iPtr); - } - if ((code != TCL_OK) && (code != TCL_ERROR) - && !allowExceptions) { - ProcessUnexpectedResult(interp, code); - code = TCL_ERROR; - } - } goto error; } for (i = 0; i < objectsUsed; i++) { @@ -3749,6 +3746,16 @@ Tcl_EvalEx(interp, script, numBytes, flags) * to the command. */ + if (iPtr->numLevels == 0) { + if (code == TCL_RETURN) { + code = TclUpdateReturnInfo(iPtr); + } + if ((code != TCL_OK) && (code != TCL_ERROR) + && !allowExceptions) { + ProcessUnexpectedResult(interp, code); + code = TCL_ERROR; + } + } if ((code == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) { commandLength = parse.commandSize; if (parse.term == parse.commandStart + commandLength - 1) { |