diff options
author | dgp <dgp@users.sourceforge.net> | 2014-12-11 16:00:19 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-12-11 16:00:19 (GMT) |
commit | 40ae358427d50647875105fb9760de916f5b56d1 (patch) | |
tree | 7a6e1e55bca4cf20783533e7c95d20021cac2c68 | |
parent | 5ebd0feb1ccf775ec9f6dec2643698330dce1467 (diff) | |
download | tcl-40ae358427d50647875105fb9760de916f5b56d1.zip tcl-40ae358427d50647875105fb9760de916f5b56d1.tar.gz tcl-40ae358427d50647875105fb9760de916f5b56d1.tar.bz2 |
Similar conversion of the [dict append] compiler.
-rw-r--r-- | generic/tclCompCmds.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 0c5b19d..a0f493c 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1156,18 +1156,17 @@ TclCompileDictAppendCmd( * compiled. */ CompileEnv *envPtr) /* Holds resulting instructions. */ { - Proc *procPtr = envPtr->procPtr; - DefineLineInformation; /* TIP #280 */ Tcl_Token *tokenPtr; - int i, dictVarIndex; + int i, isSimple, isScalar, dictVarIndex; + DefineLineInformation; /* TIP #280 */ /* - * There must be at least two argument after the command. And we impose an - * (arbirary) safe limit; anyone exceeding it should stop worrying about - * speed quite so much. ;-) + * There must be at least two argument after the command. Since we + * implement using INST_CONCAT1, make sure the number of arguments + * stays within its range. */ - if (parsePtr->numWords<4 || parsePtr->numWords>100 || procPtr==NULL) { + if (parsePtr->numWords<4 || parsePtr->numWords>258) { return TCL_ERROR; } @@ -1176,16 +1175,10 @@ TclCompileDictAppendCmd( */ tokenPtr = TokenAfter(parsePtr->tokenPtr); - if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + PushVarNameWord(interp, tokenPtr, envPtr, TCL_CREATE_VAR, + &dictVarIndex, &isSimple, &isScalar, 1); + if (!isScalar || dictVarIndex < 0) { return TCL_ERROR; - } else { - register const char *name = tokenPtr[1].start; - register int nameChars = tokenPtr[1].size; - - if (!TclIsLocalScalar(name, nameChars)) { - return TCL_ERROR; - } - dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, procPtr); } /* |