diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2012-11-03 12:48:08 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2012-11-03 12:48:08 (GMT) |
| commit | 576354fe626ac1a005e98db366f53b1a23b14f72 (patch) | |
| tree | 8fc7ea69a4c9b8e0663f45ef45bc77db6f9a29ec /generic/tclCompCmds.c | |
| parent | fe4cd2b40a7333e64321b53988575b93ea1e1ad1 (diff) | |
| download | tcl-576354fe626ac1a005e98db366f53b1a23b14f72.zip tcl-576354fe626ac1a005e98db366f53b1a23b14f72.tar.gz tcl-576354fe626ac1a005e98db366f53b1a23b14f72.tar.bz2 | |
Added compilation of [info object isa object] (i.e., object verification).
Diffstat (limited to 'generic/tclCompCmds.c')
| -rw-r--r-- | generic/tclCompCmds.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index e476cf0..0829072 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -3688,6 +3688,42 @@ TclCompileInfoObjectClassCmd( } int +TclCompileInfoObjectIsACmd( + Tcl_Interp *interp, /* Used for error reporting. */ + 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) +{ + DefineLineInformation; /* TIP #280 */ + Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr); + + /* + * We only handle [info object isa object <somevalue>]. The first three + * words are compressed to a single token by the ensemble compilation + * engine. + */ + + if (parsePtr->numWords != 3) { + return TCL_ERROR; + } + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD || tokenPtr[1].size < 1 + || strncmp(tokenPtr[1].start, "object", tokenPtr[1].size)) { + return TCL_ERROR; + } + tokenPtr = TokenAfter(tokenPtr); + + /* + * Issue the code. + */ + + CompileWord(envPtr, tokenPtr, interp, 2); + TclEmitOpcode( INST_TCLOO_IS_OBJECT, envPtr); + return TCL_OK; +} + +int TclCompileInfoObjectNamespaceCmd( Tcl_Interp *interp, /* Used for error reporting. */ Tcl_Parse *parsePtr, /* Points to a parse structure for the command |
