diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-03 12:48:08 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-11-03 12:48:08 (GMT) |
commit | ecb5e9981dc6a833c08ccd3c8a2aba31db07061d (patch) | |
tree | 8fc7ea69a4c9b8e0663f45ef45bc77db6f9a29ec /generic/tclCompCmds.c | |
parent | ce7c13b7962d2ebcd432dfb05fffe812c4d172d2 (diff) | |
download | tcl-ecb5e9981dc6a833c08ccd3c8a2aba31db07061d.zip tcl-ecb5e9981dc6a833c08ccd3c8a2aba31db07061d.tar.gz tcl-ecb5e9981dc6a833c08ccd3c8a2aba31db07061d.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 |