diff options
author | hobbs <hobbs@noemail.net> | 1999-10-29 03:03:58 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 1999-10-29 03:03:58 (GMT) |
commit | 5d174d9cb0ed7bf95bbd275481ba42d257ffba64 (patch) | |
tree | 2550a48f32cd8d0e46db002b52b75fa1deff247a /generic/tclCompCmds.c | |
parent | 80579faaa900176397e4ba854b8494bae8c25046 (diff) | |
download | tcl-5d174d9cb0ed7bf95bbd275481ba42d257ffba64.zip tcl-5d174d9cb0ed7bf95bbd275481ba42d257ffba64.tar.gz tcl-5d174d9cb0ed7bf95bbd275481ba42d257ffba64.tar.bz2 |
* generic/tclStringObj.c: fixed Tcl_AppendResultVA so it only
iterates once over the va_list (avoiding a memcpy of it,
which is not portable).
* generic/tclEnv.c: fixed possible ABR error in environ array
* tests/scan.test:
* generic/tclScan.c: added support for use of inline scan,
XPG3 currently not included
* tests/incr.test:
* tests/set.test:
* generic/tclCompCmds.c: fixed improper bytecode handling of
'eval {set array($unknownvar) 5}' (also for incr)
* win/tclWinTest.c: added testvolumetype command, as atime is
completely ignored for Windows FAT file systems
* win/tclWinPort.h: added sys/utime.h to includes
* unix/tclUnixPort.h: added utime.h to includes
* doc/file.n:
* tests/cmdAH.test:
* generic/tclCmdAH.c: added time arguments to atime and mtime
file command methods (support 'touch' functionality)
FossilOrigin-Name: 2c17586d2ad8c1b9d303ea5d8ab2568a9ce5542e
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r-- | generic/tclCompCmds.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 9566a2f..5577bf1 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.3 1999/08/19 02:59:08 hobbs Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.4 1999/10/29 03:04:00 hobbs Exp $ */ #include "tclInt.h" @@ -1341,7 +1341,16 @@ TclCompileIncrCmd(interp, parsePtr, envPtr) varTokenPtr = parsePtr->tokenPtr + (parsePtr->tokenPtr->numComponents + 1); - if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + /* + * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether + * curly braces surround the variable name. + * This really matters for array elements to handle things like + * set {x($foo)} 5 + * which raises an undefined var error if we are not careful here. + * This goes with the hack in TclCompileSetCmd. + */ + if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && + (varTokenPtr->start[0] != '{')) { /* * A simple variable name. Divide it up into "name" and "elName" * strings. If it is not a local variable, look it up at runtime. @@ -1600,8 +1609,18 @@ TclCompileSetCmd(interp, parsePtr, envPtr) varTokenPtr = parsePtr->tokenPtr + (parsePtr->tokenPtr->numComponents + 1); - if (varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) { + /* + * Check not only that the type is TCL_TOKEN_SIMPLE_WORD, but whether + * curly braces surround the variable name. + * This really matters for array elements to handle things like + * set {x($foo)} 5 + * which raises an undefined var error if we are not careful here. + * This goes with the hack in TclCompileIncrCmd. + */ + if ((varTokenPtr->type == TCL_TOKEN_SIMPLE_WORD) && + (varTokenPtr->start[0] != '{')) { simpleVarName = 1; + name = varTokenPtr[1].start; nameChars = varTokenPtr[1].size; /* last char is ')' => potential array reference */ |