diff options
author | dgp <dgp@users.sourceforge.net> | 2014-12-09 20:45:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-12-09 20:45:30 (GMT) |
commit | 2f98d437c6f6fe174b88cd5e65eba288e0f3128a (patch) | |
tree | 8c05cdb95555792616721ba40ece1d8d48e49821 | |
parent | 79a19a1fcbb36bd0b0e41da53fda3ee8be77efc9 (diff) | |
download | tcl-2f98d437c6f6fe174b88cd5e65eba288e0f3128a.zip tcl-2f98d437c6f6fe174b88cd5e65eba288e0f3128a.tar.gz tcl-2f98d437c6f6fe174b88cd5e65eba288e0f3128a.tar.bz2 |
[e711ffb458] Replace TclIsLocalScalar() with PushVarNameWord() in the
compiler for [dict set].
-rw-r--r-- | generic/tclCompCmds.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 7ecdc9b..ec22f65 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -683,17 +683,15 @@ TclCompileDictSetCmd( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Token *tokenPtr; - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *varTokenPtr; - int i, dictVarIndex, nameChars; - const char *name; + int i, isSimple, isScalar = 0, dictVarIndex = -1; + DefineLineInformation; /* TIP #280 */ /* - * There must be at least one argument after the command. + * There must be at least three arguments after the (sub-)command. */ - if (parsePtr->numWords < 4 || procPtr == NULL) { + if (parsePtr->numWords < 4) { return TCL_ERROR; } @@ -704,15 +702,11 @@ TclCompileDictSetCmd( */ varTokenPtr = TokenAfter(parsePtr->tokenPtr); - 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); /* * Remaining words (key path and value to set) can be handled normally. |