summaryrefslogtreecommitdiff
path: root/lib/class.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-05-09 01:31:31 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-05-09 01:38:54 (GMT)
commit28bf928cf81eec720bc8a31179a0c9cf688d5af3 (patch)
tree5434af73a1a67e0648acfd2a0b3dd4979c5769c6 /lib/class.tcl
parentc74b6c66f00ce51b2c01d20fc5ef0e6429811124 (diff)
downloadgit-28bf928cf81eec720bc8a31179a0c9cf688d5af3.zip
git-28bf928cf81eec720bc8a31179a0c9cf688d5af3.tar.gz
git-28bf928cf81eec720bc8a31179a0c9cf688d5af3.tar.bz2
git-gui: Don't attempt to inline array reads in methods
If a variable reference to a field is to an array, and it is the only reference to that field in that method we cannot make it an inlined [set foo] call as the regexp was converting the Tcl code wrong. We were producing "[set foo](x)" for "$foo(x)", and that isn't valid Tcl when foo is an array. So we just punt if the only occurance has a ( after it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/class.tcl')
-rw-r--r--lib/class.tcl3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/class.tcl b/lib/class.tcl
index c129198..88b0565 100644
--- a/lib/class.tcl
+++ b/lib/class.tcl
@@ -96,7 +96,8 @@ proc method {name params body {deleted {}} {del_body {}}} {
set n [lindex $n 0]
if {[regexp -- $n\\M $body]} {
if { [regexp -all -- $n\\M $body] == 1
- && [regexp -all -- \\\$$n\\M $body] == 1} {
+ && [regexp -all -- \\\$$n\\M $body] == 1
+ && [regexp -all -- \\\$$n\\( $body] == 0} {
regsub -all \\\$$n\\M $body "\[set \${this}::$n\]" body
} else {
append decl { ${this}::} $n { } $n