diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-12-18 09:37:42 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-12-18 09:37:42 (GMT) |
commit | 71500874b393cf7e4a8528218307492dd88d18b7 (patch) | |
tree | cd865326023036aca917d9898007c483abbf6012 /generic/tclCompCmdsSZ.c | |
parent | 901205117837f6f8d421eabfe1b8d6278af9c297 (diff) | |
download | tcl-71500874b393cf7e4a8528218307492dd88d18b7.zip tcl-71500874b393cf7e4a8528218307492dd88d18b7.tar.gz tcl-71500874b393cf7e4a8528218307492dd88d18b7.tar.bz2 |
Generate better code for the common case of subst-ed variables where the
variable is a simple scalar or an array with a simple literal element name.
Diffstat (limited to 'generic/tclCompCmdsSZ.c')
-rw-r--r-- | generic/tclCompCmdsSZ.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index 9c93fb2..71a1dfc 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -836,6 +836,21 @@ TclSubstCompile( TclEmitPush(literal, envPtr); count++; continue; + case TCL_TOKEN_VARIABLE: + /* + * Simple variable access; can only generate TCL_OK or TCL_ERROR + * so no need to generate elaborate exception-management code. + */ + + if (tokenPtr->numComponents == 1 || (tokenPtr->numComponents == 2 + && tokenPtr[2].type == TCL_TOKEN_TEXT)) { + envPtr->line = bline; + TclCompileVarSubst(interp, tokenPtr, envPtr); + bline = envPtr->line; + count++; + continue; + } + break; } while (count > 255) { |