summaryrefslogtreecommitdiffstats
path: root/generic/tclCompile.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2002-06-16 22:24:12 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2002-06-16 22:24:12 (GMT)
commitdceff402a0bef88886de4f644b0b312b86f021e0 (patch)
tree4c3f263eaf133a5ef6884f640d65aa4cd3f89143 /generic/tclCompile.c
parent9f5e83a07bc6c07bee76ef80ffc94146b02adacd (diff)
downloadtcl-dceff402a0bef88886de4f644b0b312b86f021e0.zip
tcl-dceff402a0bef88886de4f644b0b312b86f021e0.tar.gz
tcl-dceff402a0bef88886de4f644b0b312b86f021e0.tar.bz2
[Bug 569438] in the processing of dollar variables
Diffstat (limited to 'generic/tclCompile.c')
-rw-r--r--generic/tclCompile.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 3c3a7ff..2ed6ee0 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.34 2002/06/11 15:42:20 msofer Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.35 2002/06/16 22:24:12 msofer Exp $
*/
#include "tclInt.h"
@@ -1203,20 +1203,35 @@ TclCompileTokens(interp, tokenPtr, count, envPtr)
/*
* Either push the variable's name, or find its index in
- * the array of local variables in a procedure frame.
+ * the array of local variables in a procedure frame.
*/
- if ((envPtr->procPtr == NULL) || hasNsQualifiers) {
- localVar = -1;
- TclEmitPush(TclRegisterLiteral(envPtr, name, nameBytes,
- /*onHeap*/ 0), envPtr);
- } else {
+ localVar = -1;
+ if ((envPtr->procPtr != NULL) && !hasNsQualifiers) {
+ int createVar = 1;
+ char *p;
+
+ if ((tokenPtr->numComponents == 1)
+ && (*(name + nameBytes - 1) == ')')) {
+ /*
+ * Do not attempt to use a compiled local if the
+ * name has a single component that looks like
+ * an array element (see [Bug 569438]).
+ */
+
+ for (p = name; p < name + nameBytes; p++) {
+ if (*p == '(') {
+ createVar = 0;
+ break;
+ }
+ }
+ }
localVar = TclFindCompiledLocal(name, nameBytes,
- /*create*/ 1, /*flags*/ 0, envPtr->procPtr);
- if (localVar < 0) {
- TclEmitPush(TclRegisterLiteral(envPtr, name,
- nameBytes, /*onHeap*/ 0), envPtr);
- }
+ createVar, /*flags*/ 0, envPtr->procPtr);
+ }
+ if (localVar < 0) {
+ TclEmitPush(TclRegisterLiteral(envPtr, name,
+ nameBytes, /*onHeap*/ 0), envPtr);
}
/*