summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclCompCmds.c7
-rw-r--r--tests/dict.test6
2 files changed, 9 insertions, 4 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 572331b..e26f29c 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -839,7 +839,7 @@ TclCompileDictSetCmd(
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
- int numWords, i, dictVarIndex;
+ int i, dictVarIndex;
DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr;
@@ -868,8 +868,7 @@ TclCompileDictSetCmd(
*/
tokenPtr = TokenAfter(varTokenPtr);
- numWords = parsePtr->numWords-1;
- for (i=1 ; i<numWords ; i++) {
+ for (i=2 ; i< parsePtr->numWords ; i++) {
CompileWord(envPtr, tokenPtr, interp, i);
tokenPtr = TokenAfter(tokenPtr);
}
@@ -878,7 +877,7 @@ TclCompileDictSetCmd(
* Now emit the instruction to do the dict manipulation.
*/
- TclEmitInstInt4( INST_DICT_SET, numWords-2, envPtr);
+ TclEmitInstInt4( INST_DICT_SET, parsePtr->numWords-3, envPtr);
TclEmitInt4( dictVarIndex, envPtr);
TclAdjustStackDepth(-1, envPtr);
return TCL_OK;
diff --git a/tests/dict.test b/tests/dict.test
index 6c00c62..3658581 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -1870,6 +1870,12 @@ test dict-23.3 {CompileWord OBOE} {
apply {{} {tcl::dict::lappend foo bar \
[format baz]}}
} {bar baz}
+test dict-23.4 {CompileWord OBOE} {
+ apply {n {
+ dict set foo {*}{
+ } [return [incr n -[linenumber]]] val
+ }} [linenumber]
+} 1
rename linenumber {}
test dict-24.22 {dict map results (non-compiled)} {