diff options
author | ferrieux <ferrieux@users.sourceforge.net> | 2008-11-19 00:00:20 (GMT) |
---|---|---|
committer | ferrieux <ferrieux@users.sourceforge.net> | 2008-11-19 00:00:20 (GMT) |
commit | 3f59149579bd66510f70ecdd2cb420bb1e45e614 (patch) | |
tree | b071cca2cf088b23f530ec5aae3924e0938b5205 /generic | |
parent | 7101dee3d37069077777424ac90b183db88d57bf (diff) | |
download | tcl-3f59149579bd66510f70ecdd2cb420bb1e45e614.zip tcl-3f59149579bd66510f70ecdd2cb420bb1e45e614.tar.gz tcl-3f59149579bd66510f70ecdd2cb420bb1e45e614.tar.bz2 |
Simplification of expanded-literals handling after analysis of dead branches
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCompCmds.c | 8 | ||||
-rw-r--r-- | generic/tclCompile.c | 34 | ||||
-rw-r--r-- | generic/tclParse.c | 6 |
3 files changed, 12 insertions, 36 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index e36d546..74dceac 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.149 2008/11/17 22:26:53 ferrieux Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.150 2008/11/19 00:00:20 ferrieux Exp $ */ #include "tclInt.h" @@ -4438,7 +4438,7 @@ TclCompileSwitchCmd( * Keep in sync with TclCompileRegexpCmd. */ - if (bodyToken[i]->type & (TCL_TOKEN_TEXT|TCL_TOKEN_UNCOLLAPSED_TEXT)) { + if (bodyToken[i]->type == TCL_TOKEN_TEXT) { Tcl_DString ds; if (bodyToken[i]->size == 0) { @@ -4983,8 +4983,8 @@ PushVarName( } } } else if (((n = varTokenPtr->numComponents) > 1) - && (varTokenPtr[1].type & (TCL_TOKEN_TEXT|TCL_TOKEN_UNCOLLAPSED_TEXT)) - && (varTokenPtr[n].type & (TCL_TOKEN_TEXT|TCL_TOKEN_UNCOLLAPSED_TEXT)) + && (varTokenPtr[1].type == TCL_TOKEN_TEXT) + && (varTokenPtr[n].type == TCL_TOKEN_TEXT) && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) { /* diff --git a/generic/tclCompile.c b/generic/tclCompile.c index fe282d4..c73be7d 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.161 2008/11/17 22:26:53 ferrieux Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.162 2008/11/19 00:00:20 ferrieux Exp $ */ #include "tclInt.h" @@ -1461,20 +1461,8 @@ TclCompileScript( * namespaces to reduce shimmering. */ - if (tokenPtr[1].type & TCL_TOKEN_UNCOLLAPSED_TEXT) - { - char *s; - int n; - - s=ckalloc(tokenPtr[1].size); - n=TclCopyAndCollapse(tokenPtr[1].size,tokenPtr[1].start,s); - objIndex = TclRegisterLiteral(envPtr,s,n,LITERAL_NS_SCOPE|LITERAL_ON_HEAP); - } - else - { - objIndex = TclRegisterNewNSLiteral(envPtr, - tokenPtr[1].start, tokenPtr[1].size); - } + objIndex = TclRegisterNewNSLiteral(envPtr, + tokenPtr[1].start, tokenPtr[1].size); if (cmdPtr != NULL) { TclSetCmdNameObj(interp, envPtr->literalArrayPtr[objIndex].objPtr,cmdPtr); @@ -1497,20 +1485,8 @@ TclCompileScript( * unmodified. We care only if the we are in a context * which already allows absolute counting. */ - if (tokenPtr[1].type & TCL_TOKEN_UNCOLLAPSED_TEXT) - { - char *s; - int n; - - s=ckalloc(tokenPtr[1].size); - n=TclCopyAndCollapse(tokenPtr[1].size,tokenPtr[1].start,s); - objIndex = TclRegisterLiteral(envPtr,s,n,LITERAL_ON_HEAP); - } - else - { - objIndex = TclRegisterNewLiteral(envPtr, - tokenPtr[1].start, tokenPtr[1].size); - } + objIndex = TclRegisterNewLiteral(envPtr, + tokenPtr[1].start, tokenPtr[1].size); if (eclPtr->type == TCL_LOCATION_SOURCE) { EnterCmdWordIndex(eclPtr, diff --git a/generic/tclParse.c b/generic/tclParse.c index e1278a0..9f10e76 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.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: tclParse.c,v 1.74 2008/11/17 22:26:54 ferrieux Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.75 2008/11/19 00:00:20 ferrieux Exp $ */ #include "tclInt.h" @@ -568,7 +568,7 @@ Tcl_ParseCommand( tokenPtr->type = TCL_TOKEN_EXPAND_WORD; } } else if ((tokenPtr->numComponents == 1) - && (tokenPtr[1].type & (TCL_TOKEN_TEXT|TCL_TOKEN_UNCOLLAPSED_TEXT))) { + && (tokenPtr[1].type == TCL_TOKEN_TEXT)) { tokenPtr->type = TCL_TOKEN_SIMPLE_WORD; } @@ -1983,7 +1983,7 @@ Tcl_SubstObj( if (varTokenPtr->type != TCL_TOKEN_VARIABLE) { Tcl_Panic("Tcl_SubstObj: programming error"); } - if (!(varTokenPtr[1].type & (TCL_TOKEN_TEXT|TCL_TOKEN_UNCOLLAPSED_TEXT))) { + if (!(varTokenPtr[1].type == TCL_TOKEN_TEXT)) { Tcl_Panic("Tcl_SubstObj: programming error"); } parsePtr->numTokens -= 2; |