summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmdsSZ.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-12-18 09:37:42 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-12-18 09:37:42 (GMT)
commit71500874b393cf7e4a8528218307492dd88d18b7 (patch)
treecd865326023036aca917d9898007c483abbf6012 /generic/tclCompCmdsSZ.c
parent901205117837f6f8d421eabfe1b8d6278af9c297 (diff)
downloadtcl-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.c15
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) {