diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2013-12-29 16:59:15 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2013-12-29 16:59:15 (GMT) |
| commit | 0eb1683f540645d4a437c100db52166b03fc5c97 (patch) | |
| tree | ad0cf3ea2e58d4bf1a264a348efdf6ae6e820c2c /generic/tclCompCmdsSZ.c | |
| parent | 881616de064671aa2a1ddf37289bcee348951523 (diff) | |
| download | tcl-0eb1683f540645d4a437c100db52166b03fc5c97.zip tcl-0eb1683f540645d4a437c100db52166b03fc5c97.tar.gz tcl-0eb1683f540645d4a437c100db52166b03fc5c97.tar.bz2 | |
use the new instruction
Diffstat (limited to 'generic/tclCompCmdsSZ.c')
| -rw-r--r-- | generic/tclCompCmdsSZ.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 110476e..649a76a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -765,12 +765,25 @@ TclCompileStringReplaceCmd( } else { /* - * Too complicated to optimize, but we know the number of arguments is - * correct so we can issue a call of the "standard" implementation. + * Need to process indices at runtime. This could be because the + * indices are not constants, or because we need to resolve them to + * absolute indices to work out if a replacement is going to happen. + * In any case, to runtime it is. */ genericReplace: - return TclCompileBasicMin0ArgCmd(interp, parsePtr, cmdPtr, envPtr); + CompileWord(envPtr, valueTokenPtr, interp, 1); + tokenPtr = TokenAfter(valueTokenPtr); + CompileWord(envPtr, tokenPtr, interp, 2); + tokenPtr = TokenAfter(tokenPtr); + CompileWord(envPtr, tokenPtr, interp, 3); + if (replacementTokenPtr != NULL) { + CompileWord(envPtr, replacementTokenPtr, interp, 4); + } else { + PUSH( ""); + } + OP( STR_REPLACE); + return TCL_OK; } } |
