summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-10-03 10:45:35 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-10-03 10:45:35 (GMT)
commitf5da66af9b1d20982f24f809029662cdf55fe3b0 (patch)
tree50130e480fa011b6a08d1873587e28d09ec541af /generic/tclExecute.c
parent12b24fa2fb8f381005e95bb52ab317ccfaae110e (diff)
downloadtcl-f5da66af9b1d20982f24f809029662cdf55fe3b0.zip
tcl-f5da66af9b1d20982f24f809029662cdf55fe3b0.tar.gz
tcl-f5da66af9b1d20982f24f809029662cdf55fe3b0.tar.bz2
Added support for having the dict var itself referenced by LVT index.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c60
1 files changed, 47 insertions, 13 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index e3db83e..953c63e 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -6122,26 +6122,60 @@ TEBCresume(
TRACE_APPEND(("%.30s\n", O2S(objResultPtr)));
NEXT_INST_F(1, 2, 1);
- case INST_DICT_RECOMBINE:
- varNamePtr = OBJ_AT_DEPTH(2);
- listPtr = OBJ_UNDER_TOS;
- keysPtr = OBJ_AT_TOS;
+ case INST_DICT_RECOMBINE_STK:
+ keysPtr = POP_OBJECT();
+ varNamePtr = OBJ_UNDER_TOS;
+ listPtr = OBJ_AT_TOS;
+ TRACE(("\"%.30s\" \"%.30s\" \"%.30s\" => ",
+ O2S(varNamePtr), O2S(valuePtr), O2S(keysPtr)));
if (TclListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) {
- TRACE_WITH_OBJ(("%.30s %.30s %.30s => ERROR: ",
- O2S(varNamePtr), O2S(listPtr), O2S(keysPtr)),
- Tcl_GetObjResult(interp));
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ TclDecrRefCount(keysPtr);
goto gotError;
}
- if (TclDictWithFinish(interp, varNamePtr, objc, objv,
- keysPtr) != TCL_OK) {
- TRACE_WITH_OBJ(("%.30s %.30s %.30s => ERROR: ",
- O2S(varNamePtr), O2S(listPtr), O2S(keysPtr)),
- Tcl_GetObjResult(interp));
+ varPtr = TclObjLookupVarEx(interp, varNamePtr, NULL,
+ TCL_LEAVE_ERR_MSG, "set", 1, 1, &arrayPtr);
+ if (varPtr == NULL) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ TclDecrRefCount(keysPtr);
goto gotError;
}
+ DECACHE_STACK_INFO();
+ result = TclDictWithFinish(interp, varPtr,arrayPtr,varNamePtr,NULL,-1,
+ objc, objv, keysPtr);
+ CACHE_STACK_INFO();
TclDecrRefCount(keysPtr);
- POP_OBJECT();
+ if (result != TCL_OK) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ goto gotError;
+ }
+ TRACE_APPEND(("OK\n"));
NEXT_INST_F(1, 2, 0);
+
+ case INST_DICT_RECOMBINE_IMM:
+ opnd = TclGetUInt4AtPtr(pc+1);
+ listPtr = OBJ_UNDER_TOS;
+ keysPtr = OBJ_AT_TOS;
+ varPtr = LOCAL(opnd);
+ TRACE(("%u <- \"%.30s\" \"%.30s\" => ", opnd, O2S(valuePtr),
+ O2S(keysPtr)));
+ if (TclListObjGetElements(interp, listPtr, &objc, &objv) != TCL_OK) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ goto gotError;
+ }
+ while (TclIsVarLink(varPtr)) {
+ varPtr = varPtr->value.linkPtr;
+ }
+ DECACHE_STACK_INFO();
+ result = TclDictWithFinish(interp, varPtr, NULL, NULL, NULL, opnd,
+ objc, objv, keysPtr);
+ CACHE_STACK_INFO();
+ if (result != TCL_OK) {
+ TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp))));
+ goto gotError;
+ }
+ TRACE_APPEND(("OK\n"));
+ NEXT_INST_F(5, 2, 0);
}
/*