summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-12-09 20:29:09 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-12-09 20:29:09 (GMT)
commit79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9 (patch)
treeb3b254bfcfebf31f5c21ebb4f60bf88c890db32c
parentd86c0849b3c0ed313c45e7fb28c62df8577fb690 (diff)
downloadtcl-79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9.zip
tcl-79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9.tar.gz
tcl-79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9.tar.bz2
[e711ffb458] Replace TclIsLocalScalar() (which does the wrong thing).... with
PushVarNameWord() (which doesn't) in the compiler for [dict lappend].
-rw-r--r--generic/tclCompCmds.c18
-rw-r--r--generic/tclCompile.c4
2 files changed, 8 insertions, 14 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index c8ca828..7ecdc9b 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -1284,32 +1284,26 @@ TclCompileDictLappendCmd(
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
- Proc *procPtr = envPtr->procPtr;
- DefineLineInformation; /* TIP #280 */
Tcl_Token *varTokenPtr, *keyTokenPtr, *valueTokenPtr;
- int dictVarIndex, nameChars;
- const char *name;
+ int isSimple, dictVarIndex = -1, isScalar = 0;
+ DefineLineInformation; /* TIP #280 */
/*
* There must be three arguments after the command.
*/
- if (parsePtr->numWords != 4 || procPtr == NULL) {
+ if (parsePtr->numWords != 4) {
return TCL_ERROR;
}
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
keyTokenPtr = TokenAfter(varTokenPtr);
valueTokenPtr = TokenAfter(keyTokenPtr);
- if (varTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
- return TCL_ERROR;
- }
- name = varTokenPtr[1].start;
- nameChars = varTokenPtr[1].size;
- if (!TclIsLocalScalar(name, nameChars)) {
+ PushVarNameWord(interp, varTokenPtr, envPtr, TCL_CREATE_VAR,
+ &dictVarIndex, &isSimple, &isScalar, 1);
+ if (!isScalar || dictVarIndex < 0) {
return TCL_ERROR;
}
- dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr);
CompileWord(envPtr, keyTokenPtr, interp, 2);
CompileWord(envPtr, valueTokenPtr, interp, 3);
TclEmitInstInt4( INST_DICT_LAPPEND, dictVarIndex, envPtr);
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index f982359..5030f89 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -2288,8 +2288,8 @@ TclFindCompiledLocal(
* scalar or array variable. If NULL, a
* temporary var should be created. */
int nameBytes, /* Number of bytes in the name. */
- int create, /* If 1, allocate a local frame entry for the
- * variable if it is new. */
+ int create, /* If non-zero, allocate a local frame entry
+ * for the variable if it is new. */
register Proc *procPtr) /* Points to structure describing procedure
* containing the variable reference. */
{