summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-08-25 00:08:46 (GMT)
committerhobbs <hobbs>2001-08-25 00:08:46 (GMT)
commit7e9026564a47cb082b994611f37bb2ffdd092288 (patch)
tree6103931277f3ee2c92476c4d1342bfbac77fc72e
parent94828be6566ab66759502d691b58a356d6250475 (diff)
downloadtcl-7e9026564a47cb082b994611f37bb2ffdd092288.zip
tcl-7e9026564a47cb082b994611f37bb2ffdd092288.tar.gz
tcl-7e9026564a47cb082b994611f37bb2ffdd092288.tar.bz2
* tests/stringComp.test: added string-1.3
* generic/tclCompCmds.c (TclCompileStringCmd): changed to return TCL_OUT_LINE_COMPILE instead of TCL_ERROR when compiling and an unknown string method is called. This is necessary as the string command may be never called, or not until 'string' is redefined.
-rw-r--r--ChangeLog8
-rw-r--r--generic/tclCompCmds.c5
-rw-r--r--tests/stringComp.test11
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c154c92..47bc4c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-08-24 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/stringComp.test: added string-1.3
+ * generic/tclCompCmds.c (TclCompileStringCmd): changed to return
+ TCL_OUT_LINE_COMPILE instead of TCL_ERROR when compiling and an
+ unknown string method is called. This is necessary as the string
+ command may be never called, or not until 'string' is redefined.
+
2001-08-24 Vince Darley <vincentdarley@users.sourceforge.net>
* doc/glob.n: documented windows-style path issue with glob.
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index a61f962..20616d5 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.10 2001/08/22 13:57:53 msofer Exp $
+ * RCS: @(#) $Id: tclCompCmds.c,v 1.11 2001/08/25 00:08:46 hobbs Exp $
*/
#include "tclInt.h"
@@ -2182,7 +2182,8 @@ TclCompileStringCmd(interp, parsePtr, envPtr)
if (Tcl_GetIndexFromObj(interp, opObj, options, "option", 0,
&index) != TCL_OK) {
Tcl_DecrRefCount(opObj);
- return TCL_ERROR;
+ Tcl_ResetResult(interp);
+ return TCL_OUT_LINE_COMPILE;
}
Tcl_DecrRefCount(opObj);
diff --git a/tests/stringComp.test b/tests/stringComp.test
index 89b641d..fc2214c 100644
--- a/tests/stringComp.test
+++ b/tests/stringComp.test
@@ -14,7 +14,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: stringComp.test,v 1.2 2001/05/17 02:21:06 hobbs Exp $
+# RCS: @(#) $Id: stringComp.test,v 1.3 2001/08/25 00:08:46 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -34,6 +34,15 @@ test string-1.2 {error conditions} {
proc foo {} {string}
list [catch {foo} msg] $msg
} {1 {wrong # args: should be "string option arg ?arg ...?"}}
+test string-1.3 {error condition - undefined method during compile} {
+ # We don't want this to complain about 'never' because it may never
+ # be called, or string may get redefined. This must compile OK.
+ proc foo {str i} {
+ if {"yes" == "no"} { string never called but complains here }
+ string index $str $i
+ }
+ foo abc 0
+} a
test string-2.1 {string compare, too few args} {
proc foo {} {string compare a}