diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2006-09-30 17:56:45 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2006-09-30 17:56:45 (GMT) |
commit | 7d238aee5a63e4f16bafa9863ec090f904e66df2 (patch) | |
tree | ad9a7220c6ca69cd16f1f4d0574ec34d46c1ad63 /generic/tclCompile.c | |
parent | 858a806396de6a90554a6ebd0ce288b554f61ac7 (diff) | |
download | tcl-7d238aee5a63e4f16bafa9863ec090f904e66df2.zip tcl-7d238aee5a63e4f16bafa9863ec090f904e66df2.tar.gz tcl-7d238aee5a63e4f16bafa9863ec090f904e66df2.tar.bz2 |
* generic/tclCompile.c:
* generic/tclHistory.c:
* generic/tclInt.h:
* generic/tclProc.c: made Tcl_RecordAndEvalObj not call "history"
if it has been redefined to an empty proc, in order to reduce the
noise when debugging [FR 1190441]. Moved TclCompileNoOp from
tclProc.c to tclCompile.c
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r-- | generic/tclCompile.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 2be8b05..ddaee64 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.97 2006/08/29 06:28:38 das Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.98 2006/09/30 17:56:46 msofer Exp $ */ #include "tclInt.h" @@ -1636,6 +1636,51 @@ TclCompileExprWords( /* *---------------------------------------------------------------------- * + * TclCompileNoOp -- + * + * Function called to compile no-op's + * + * Results: + * The return value is TCL_OK, indicating successful compilation. + * + * Side effects: + * Instructions are added to envPtr to execute a no-op at runtime. No + * result is pushed onto the stack: the compiler has to take care of this + * itself if the last compiled command is a NoOp. + * + *---------------------------------------------------------------------- + */ + +int +TclCompileNoOp( + Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Parse *parsePtr, /* Points to a parse structure for the command + * created by Tcl_ParseCommand. */ + CompileEnv *envPtr) /* Holds resulting instructions. */ +{ + Tcl_Token *tokenPtr; + int i; + int savedStackDepth = envPtr->currStackDepth; + + tokenPtr = parsePtr->tokenPtr; + for(i = 1; i < parsePtr->numWords; i++) { + tokenPtr = tokenPtr + tokenPtr->numComponents + 1; + envPtr->currStackDepth = savedStackDepth; + + if (tokenPtr->type != TCL_TOKEN_SIMPLE_WORD) { + TclCompileTokens(interp, tokenPtr+1, tokenPtr->numComponents, + envPtr); + TclEmitOpcode(INST_POP, envPtr); + } + } + envPtr->currStackDepth = savedStackDepth; + TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TclInitByteCodeObj -- * * Create a ByteCode structure and initialize it from a CompileEnv |