summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2014-12-03 23:27:45 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2014-12-03 23:27:45 (GMT)
commit832c28c7d1a73430e8bd0e33c71ffbc846e0a6cf (patch)
tree9a203d3a9e14deb246b13b2b17d6bf121aafd7b5
parent9e5f0ade58641b9719e70838d98e562c867193dd (diff)
parent3e76a216e3a989a6dbaefd832a0a2dc795672e2e (diff)
downloadtcl-832c28c7d1a73430e8bd0e33c71ffbc846e0a6cf.zip
tcl-832c28c7d1a73430e8bd0e33c71ffbc846e0a6cf.tar.gz
tcl-832c28c7d1a73430e8bd0e33c71ffbc846e0a6cf.tar.bz2
fix var($) problem, bug [0c043a175] (thx dgp)
-rw-r--r--generic/tclCompCmds.c2
-rw-r--r--tests/compile.test13
2 files changed, 12 insertions, 3 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 18f4564..4e7ef97 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -3373,7 +3373,7 @@ TclPushVarName(
nameChars = p - varTokenPtr[1].start;
elName = p + 1;
remainingChars = (varTokenPtr[2].start - p) - 1;
- elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 2;
+ elNameChars = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
if (remainingChars) {
/*
diff --git a/tests/compile.test b/tests/compile.test
index 22ebc7d..45d69e9 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -455,14 +455,23 @@ test compile-13.1 {testing underestimate of maxStackSize in list cmd} {exec} {
list [catch {exec [interpreter] << $script} msg] $msg
} {0 OK}
-# Special test for compiling tokens from a copy of the source string. [Bug
-# 599788]
+# Tests compile-14.* for compiling tokens from a copy of the source string.
+# [Bug 599788] [Bug 0c043a175a47da8c2342]
test compile-14.1 {testing errors in element name; segfault?} {} {
catch {set a([error])} msg1
catch {set bubba([join $abba $jubba]) $vol} msg2
list $msg1 $msg2
} {{wrong # args: should be "error message ?errorInfo? ?errorCode?"} {can't read "abba": no such variable}}
+test compile-14.2 {testing element name "$"} -body {
+ unset -nocomplain a
+ set a() 1
+ set a(1) 2
+ set a($) 3
+ list [set a()] [set a(1)] [set a($)] [unset a(); lindex [array names a] 0]
+} -cleanup {unset a} -result [list 1 2 3 {$}]
+
+
# Tests compile-15.* cover Tcl Bug 633204
test compile-15.1 {proper TCL_RETURN code from [return]} {
apply {{} {catch return}}