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 | 569360bf40839acdb1eefefb0cf1fbb8b7e33083 (patch) | |
| tree | cd865326023036aca917d9898007c483abbf6012 | |
| parent | 59e42de547fbab45ff158c8caab2b2577513f723 (diff) | |
| download | tcl-569360bf40839acdb1eefefb0cf1fbb8b7e33083.zip tcl-569360bf40839acdb1eefefb0cf1fbb8b7e33083.tar.gz tcl-569360bf40839acdb1eefefb0cf1fbb8b7e33083.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.
| -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) { |
