summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c50
1 files changed, 39 insertions, 11 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 415412f..2ed4e7d 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.264 2007/03/22 18:19:47 dgp Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.265 2007/03/30 14:22:30 msofer Exp $
*/
#include "tclInt.h"
@@ -2049,12 +2049,26 @@ TclExecuteByteCode(
arrayPtr = arrayPtr->value.linkPtr;
}
TRACE(("%u \"%.30s\" => ", opnd, part2));
- varPtr = TclLookupArrayElement(interp, part1, part2,
- TCL_LEAVE_ERR_MSG, "read", 0, 1, arrayPtr);
+ if (!TclIsVarUndefined(arrayPtr)
+ && TclIsVarArray(arrayPtr)
+ && TclIsVarUntraced(arrayPtr)) {
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(arrayPtr->value.tablePtr, part2);
+ if (hPtr == NULL) {
+ varPtr = NULL;
+ } else {
+ varPtr = (Var *) Tcl_GetHashValue(hPtr);
+ }
+ } else {
+ varPtr = NULL;
+ }
if (varPtr == NULL) {
- TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
- result = TCL_ERROR;
- goto checkForCatch;
+ varPtr = TclLookupArrayElement(interp, part1, part2,
+ TCL_LEAVE_ERR_MSG, "read", 0, 1, arrayPtr);
+ if (varPtr == NULL) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ result = TCL_ERROR;
+ goto checkForCatch;
+ }
}
if (TclIsVarDirectReadable(varPtr)
&& ((arrayPtr == NULL) || TclIsVarUntraced(arrayPtr))) {
@@ -2213,12 +2227,26 @@ TclExecuteByteCode(
while (TclIsVarLink(arrayPtr)) {
arrayPtr = arrayPtr->value.linkPtr;
}
- varPtr = TclLookupArrayElement(interp, part1, part2,
- TCL_LEAVE_ERR_MSG, "set", 1, 1, arrayPtr);
+ if (!TclIsVarUndefined(arrayPtr)
+ && TclIsVarArray(arrayPtr)
+ && TclIsVarUntraced(arrayPtr)) {
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(arrayPtr->value.tablePtr, part2);
+ if (hPtr == NULL) {
+ varPtr = NULL;
+ } else {
+ varPtr = (Var *) Tcl_GetHashValue(hPtr);
+ }
+ } else {
+ varPtr = NULL;
+ }
if (varPtr == NULL) {
- TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
- result = TCL_ERROR;
- goto checkForCatch;
+ varPtr = TclLookupArrayElement(interp, part1, part2,
+ TCL_LEAVE_ERR_MSG, "set", 1, 1, arrayPtr);
+ if (varPtr == NULL) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ result = TCL_ERROR;
+ goto checkForCatch;
+ }
}
cleanup = 2;
goto doCallPtrSetVar;