diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:46:32 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-05-10 07:46:32 (GMT) |
| commit | 7b90ffbb489e5b0b09f23a6296f69f070127fd57 (patch) | |
| tree | b4b8b874d4101f811de99438daa6d037daa506f1 /generic/tclCompCmds.c | |
| parent | f9eb1833d2785265d8dc52992750ef10d9cc1c19 (diff) | |
| parent | b1139d3d2099aad8ad1981deaa0f689e1b4c322a (diff) | |
| download | tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.zip tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.tar.gz tcl-7b90ffbb489e5b0b09f23a6296f69f070127fd57.tar.bz2 | |
merge 8.7
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 c472b8c..4844dd8 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -1177,6 +1177,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 |
