diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:50:31 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:50:31 (GMT) |
| commit | a2a03ea8fb6718cc472cc7dcb44f8e68aadb24ba (patch) | |
| tree | b27d28ac5054d661fb8510ac1b75127cbf036c79 /generic/tclCompCmds.c | |
| parent | 740e938393791a7c1fe675b21ece901fa6cbdd74 (diff) | |
| parent | 216ea63416cffd9c521476d74fce958860d2acf9 (diff) | |
| download | tcl-a2a03ea8fb6718cc472cc7dcb44f8e68aadb24ba.zip tcl-a2a03ea8fb6718cc472cc7dcb44f8e68aadb24ba.tar.gz tcl-a2a03ea8fb6718cc472cc7dcb44f8e68aadb24ba.tar.bz2 | |
Merge trunk
Diffstat (limited to 'generic/tclCompCmds.c')
| -rw-r--r-- | generic/tclCompCmds.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 6ec0e26..afe16b2 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1179,6 +1179,38 @@ TclCompileDictGetCmd( } int +TclCompileDictGetWithDefaultCmd( + Tcl_Interp *interp, /* Used for looking up stuff. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + Command *cmdPtr, /* Points to defintion of command being + * compiled. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr; + int i; + DefineLineInformation; /* TIP #280 */ + + /* + * There must be at least three arguments after the command. + */ + + /* TODO: Consider support for compiling expanded args. */ + if (parsePtr->numWords < 4) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(parsePtr->tokenPtr); + + for (i=1 ; i<parsePtr->numWords ; i++) { + CompileWord(envPtr, tokenPtr, interp, i); + tokenPtr = TokenAfter(tokenPtr); + } + TclEmitInstInt4(INST_DICT_GET_DEF, parsePtr->numWords-3, envPtr); + TclAdjustStackDepth(-2, envPtr); + return TCL_OK; +} + +int TclCompileDictExistsCmd( Tcl_Interp *interp, /* Used for looking up stuff. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command |
