summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-09-19 17:01:58 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-09-19 17:01:58 (GMT)
commitb290b21a4427ac5d1584ad6fcf61e4934f1bf505 (patch)
treecd9ee01eab124e27a9b77d30fcac307790983fae
parent34f5e7a008848bf85a6a5bf4d838aa3d8d21cd07 (diff)
downloadtcl-b290b21a4427ac5d1584ad6fcf61e4934f1bf505.zip
tcl-b290b21a4427ac5d1584ad6fcf61e4934f1bf505.tar.gz
tcl-b290b21a4427ac5d1584ad6fcf61e4934f1bf505.tar.bz2
Line numbers wrong in compiled [dict exists].
-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 9829b9c..64c110d 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -1002,7 +1002,7 @@ TclCompileDictExistsCmd(
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
- int numWords, i;
+ int i;
DefineLineInformation; /* TIP #280 */
/*
@@ -1015,17 +1015,16 @@ TclCompileDictExistsCmd(
return TCL_ERROR;
}
tokenPtr = TokenAfter(parsePtr->tokenPtr);
- numWords = parsePtr->numWords-1;
/*
* Now we do the code generation.
*/
- for (i=0 ; i<numWords ; i++) {
+ for (i=1 ; i<parsePtr->numWords ; i++) {
CompileWord(envPtr, tokenPtr, interp, i);
tokenPtr = TokenAfter(tokenPtr);
}
- TclEmitInstInt4(INST_DICT_EXISTS, numWords-1, envPtr);
+ TclEmitInstInt4(INST_DICT_EXISTS, parsePtr->numWords-2, envPtr);
TclAdjustStackDepth(-1, envPtr);
return TCL_OK;
}
diff --git a/tests/dict.test b/tests/dict.test
index 797ab46..6c254eb 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -1899,6 +1899,12 @@ test dict-23.8 {CompileWord OBOE} {
} [return [incr n -[linenumber]]] x {}
}} [linenumber]
} 1
+test dict-23.9 {CompileWord OBOE} {
+ apply {n {
+ dict exists {} {*}{
+ } [return [incr n -[linenumber]]]
+ }} [linenumber]
+} 1
rename linenumber {}
test dict-24.22 {dict map results (non-compiled)} {