diff options
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r-- | generic/tclCompCmds.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index c56aee6..2abf5ab 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.109.2.19 2008/01/25 16:43:51 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.109.2.20 2008/03/07 22:05:03 dgp Exp $ */ #include "tclInt.h" @@ -3358,6 +3358,7 @@ TclCompileReturnCmd( /* Optimize [return -level 0 $x]. */ Tcl_DictObjSize(NULL, returnOpts, &size); if (size == 0 && level == 0 && code == TCL_OK) { + Tcl_DecrRefCount(returnOpts); return TCL_OK; } @@ -3967,7 +3968,7 @@ TclCompileSwitchCmd( } tokenPtr = TokenAfter(tokenPtr); numWords--; - if (noCase && (mode != Switch_Exact)) { + if (noCase && (mode == Switch_Exact)) { /* * Can't compile this case; no opcode for case-insensitive equality! */ @@ -4376,6 +4377,7 @@ TclCompileSwitchCmd( foundDefault = 0; for (i=0 ; i<numWords ; i+=2) { int nextArmFixupIndex = -1; + envPtr->currStackDepth = savedStackDepth + 1; if (i!=numWords-2 || bodyToken[numWords-2]->size != 7 || memcmp(bodyToken[numWords-2]->start, "default", 7)) { @@ -4400,6 +4402,7 @@ TclCompileSwitchCmd( /* * Keep in sync with TclCompileRegexpCmd. */ + if (bodyToken[i]->type == TCL_TOKEN_TEXT) { Tcl_DString ds; @@ -4439,13 +4442,15 @@ TclCompileSwitchCmd( } } else { /* - * Pass correct RE compile flags. We use only Int1 + * Pass correct RE compile flags. We use only Int1 * (8-bit), but that handles all the flags we want to - * pass. Don't use TCL_REG_NOSUB as we may have backrefs + * pass. Don't use TCL_REG_NOSUB as we may have backrefs * or capture vars. */ + int cflags = TCL_REG_ADVANCED - | (noCase ? TCL_REG_NOCASE : 0); + | (noCase ? TCL_REG_NOCASE : 0); + TclEmitInstInt1(INST_REGEXP, cflags, envPtr); } break; |