Tcl Source Code

Artifact [88757ce4ac]
Login

Artifact 88757ce4aca1456c76368e38c42e68daafe4d6e5:

Attachment "458548.patch" to ticket [458548ffff] added by msofer 2001-09-05 05:47:27.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.561
diff -u -r1.561 ChangeLog
--- ChangeLog	2001/09/04 18:06:34	1.561
+++ ChangeLog	2001/09/04 22:40:46
@@ -1,3 +1,8 @@
+2001-09-04  Miguel Sofer  <[email protected]>
+
+	* generic/tclProc.c: made [proc] check that formal args have
+	simple names [Bug: 458548] 
+
 2001-09-04 Vince Darley <[email protected]>
 
 	Minor bug fixes in filesystem, plus small vfs changes as a 
@@ -42,7 +47,7 @@
 	
 2001-09-04  Miguel Sofer  <[email protected]>
 
-	* generic/tclCompile.c: fixed incorrect opreands for INST_LIST
+	* generic/tclCompile.c: fixed incorrect operands for INST_LIST
 	[Bug: 458241] (David Cuthbert, [email protected])
 
 2001-09-03  Jeff Hobbs  <[email protected]>
Index: generic/tclProc.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclProc.c,v
retrieving revision 1.25
diff -u -r1.25 tclProc.c
--- generic/tclProc.c	2001/04/27 22:11:51	1.25
+++ generic/tclProc.c	2001/09/04 22:40:47
@@ -336,6 +336,14 @@
 		    ckfree((char *) fieldValues);
 		    goto procError;
 		}
+	    } else if ((*p == ':') && (*(p+1) == ':')) {
+		Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
+		        "procedure \"", procName,
+		        "\" has formal parameter \"", fieldValues[0],
+			"\" that is not a simple name",
+			(char *) NULL);
+		ckfree((char *) fieldValues);
+		goto procError;
 	    }
 	    p++;
 	}
Index: tests/proc.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/proc.test,v
retrieving revision 1.8
diff -u -r1.8 proc.test
--- tests/proc.test	2000/05/03 00:14:36	1.8
+++ tests/proc.test	2001/09/04 22:40:48
@@ -96,6 +96,11 @@
             puts "$z=z, $a(1)=$a(1)"
         }} msg] $msg
 } {1 {procedure "p" has formal parameter "a(1)" that is an array element}}
+test proc-1.8 {Tcl_ProcObjCmd, check that formal parameter names are simple names} {
+    catch {rename p ""}
+    list [catch {proc p {b:a b::a} { 
+    }} msg] $msg
+} {1 {procedure "p" has formal parameter "b::a" that is not a simple name}}
 
 test proc-2.1 {TclFindProc, simple proc name and proc not in namespace} {
     catch {eval namespace delete [namespace children :: test_ns_*]}