summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2001-09-04 22:45:52 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2001-09-04 22:45:52 (GMT)
commit3cb4a6379d2d1327bbe201c9ef0733e6fd980134 (patch)
tree90b715ced160ef0200a6451efb6a332175827cab
parent6fca271a5115b8b8e94f10dce8efb41fcedb53a9 (diff)
downloadtcl-3cb4a6379d2d1327bbe201c9ef0733e6fd980134.zip
tcl-3cb4a6379d2d1327bbe201c9ef0733e6fd980134.tar.gz
tcl-3cb4a6379d2d1327bbe201c9ef0733e6fd980134.tar.bz2
made [proc] check that formal args have simple names [Bug: 458548]
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclProc.c10
-rw-r--r--tests/proc.test7
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1dc230d..4a4a910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-09-04 Miguel Sofer <msofer@users.sourceforge.net>
+
+ * generic/tclProc.c: made [proc] check that formal args have
+ simple names [Bug: 458548]
+
2001-09-04 Vince Darley <vincentdarley@users.sourceforge.net>
Minor bug fixes in filesystem, plus small vfs changes as a
@@ -42,7 +47,7 @@
2001-09-04 Miguel Sofer <msofer@users.sourceforge.net>
- * generic/tclCompile.c: fixed incorrect opreands for INST_LIST
+ * generic/tclCompile.c: fixed incorrect operands for INST_LIST
[Bug: 458241] (David Cuthbert, dacut@users.sourceforge.net)
2001-09-03 Jeff Hobbs <jeffh@ActiveState.com>
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 4ae489d..df0f1e9 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclProc.c,v 1.25 2001/04/27 22:11:51 kennykb Exp $
+ * RCS: @(#) $Id: tclProc.c,v 1.26 2001/09/04 22:45:52 msofer Exp $
*/
#include "tclInt.h"
@@ -336,6 +336,14 @@ TclCreateProc(interp, nsPtr, procName, argsPtr, bodyPtr, procPtrPtr)
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++;
}
diff --git a/tests/proc.test b/tests/proc.test
index a96373a..8f21817 100644
--- a/tests/proc.test
+++ b/tests/proc.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: proc.test,v 1.8 2000/05/03 00:14:36 hobbs Exp $
+# RCS: @(#) $Id: proc.test,v 1.9 2001/09/04 22:45:52 msofer Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -96,6 +96,11 @@ test proc-1.7 {Tcl_ProcObjCmd, check that formal parameter names are not array e
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_*]}