diff options
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r-- | generic/tclVar.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/generic/tclVar.c b/generic/tclVar.c index ba76f00..c342522 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.35 2001/07/04 00:55:08 hobbs Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.36 2001/08/10 13:10:13 msofer Exp $ */ #include "tclInt.h" @@ -3061,19 +3061,13 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv) } /* - * Locate the array variable (and it better be an array). + * Locate the array variable */ varName = TclGetString(objv[2]); varPtr = TclLookupVar(interp, varName, (char *) NULL, /*flags*/ 0, /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); - notArray = 0; - if ((varPtr == NULL) || !TclIsVarArray(varPtr) - || TclIsVarUndefined(varPtr)) { - notArray = 1; - } - /* * Special array trace used to keep the env array in sync for * array names, array get, etc. @@ -3091,6 +3085,18 @@ Tcl_ArrayObjCmd(dummy, interp, objc, objv) } /* + * Verify that it is indeed an array variable. This test comes after + * the traces - the variable may actually become an array as an effect + * of said traces. + */ + + notArray = 0; + if ((varPtr == NULL) || !TclIsVarArray(varPtr) + || TclIsVarUndefined(varPtr)) { + notArray = 1; + } + + /* * We have to wait to get the resultPtr until here because * CallTraces can affect the result. */ |