summaryrefslogtreecommitdiffstats
path: root/generic/tclCompCmds.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-01-21 02:25:25 (GMT)
committerhobbs <hobbs>2000-01-21 02:25:25 (GMT)
commitdf05056e3fba1a1d7b9cde6fc893514f18c6c5c5 (patch)
tree3f8bc62d1bca80a5df23cb59d2c23105866f2dae /generic/tclCompCmds.c
parentdf89ccaf7788364be35910a9f84ba16a854d1643 (diff)
downloadtcl-df05056e3fba1a1d7b9cde6fc893514f18c6c5c5.zip
tcl-df05056e3fba1a1d7b9cde6fc893514f18c6c5c5.tar.gz
tcl-df05056e3fba1a1d7b9cde6fc893514f18c6c5c5.tar.bz2
* generic/tclCmdIL.c (InfoBodyCmd): made [info body] return a
string if the body has been bytecompiled. * generic/tclBasic.c (Tcl_EvalObjEx): added pedantic check for originating proc body of bytecompiled code, #def'd out as the change for [info body] should make it unnecessary * tests/set.test: added test for complex array elem name compiling * generic/tclCompCmds.c (TclCompileSetCmd): Fixed parsing of array elements during compiling, and slightly optimised same [Bug: 3889]
Diffstat (limited to 'generic/tclCompCmds.c')
-rw-r--r--generic/tclCompCmds.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 5577bf1..75fa02e 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompCmds.c,v 1.4 1999/10/29 03:04:00 hobbs Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.5 2000/01/21 02:25:26 hobbs Exp $
*/
#include "tclInt.h"
@@ -1579,7 +1579,7 @@ TclCompileSetCmd(interp, parsePtr, envPtr)
register char *p;
char *name, *elName;
int nameChars, elNameChars;
- register int i;
+ register int i, n;
int isAssignment, simpleVarName, localIndex, numWords;
int maxDepth = 0;
int code = TCL_OK;
@@ -1647,17 +1647,41 @@ TclCompileSetCmd(interp, parsePtr, envPtr)
break;
}
}
- } else if ((varTokenPtr->numComponents == 4)
+ } else if (((n = varTokenPtr->numComponents) > 1)
&& (varTokenPtr[1].type == TCL_TOKEN_TEXT)
- && (varTokenPtr[1].start[varTokenPtr[1].size-1] == '(')
- && (varTokenPtr[4].type == TCL_TOKEN_TEXT)
- && (varTokenPtr[4].size == 1)
- && (varTokenPtr[4].start[0] == ')')) {
- simpleVarName = 1;
- name = varTokenPtr[1].start;
- nameChars = varTokenPtr[1].size - 1;
- elName = varTokenPtr[2].start;
- elNameChars = varTokenPtr[2].size;
+ && (varTokenPtr[n].type == TCL_TOKEN_TEXT)
+ && (varTokenPtr[n].start[varTokenPtr[n].size - 1] == ')')) {
+ simpleVarName = 0;
+
+ /*
+ * Check for parentheses inside first token
+ */
+ for (i = 0, p = varTokenPtr[1].start;
+ i < varTokenPtr[1].size; i++, p++) {
+ if (*p == '(') {
+ simpleVarName = 1;
+ break;
+ }
+ }
+ if (simpleVarName) {
+ name = varTokenPtr[1].start;
+ nameChars = p - varTokenPtr[1].start;
+ elName = p + 1;
+ elNameChars = (varTokenPtr[n].start - p) + varTokenPtr[n].size - 2;
+
+ /*
+ * If elName contains any double quotes ("), we can't inline
+ * compile the element script using the replace '()' by '"'
+ * technique below.
+ */
+
+ for (i = 0, p = elName; i < elNameChars; i++, p++) {
+ if (*p == '"') {
+ simpleVarName = 0;
+ break;
+ }
+ }
+ }
}
if (simpleVarName) {