summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c74b6c6)
raw | patch | inline | side by side (parent: c74b6c6)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 9 May 2007 01:31:31 +0000 (21:31 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 9 May 2007 01:38:54 +0000 (21:38 -0400) |
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>
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>
lib/class.tcl | patch | blob | history |
diff --git a/lib/class.tcl b/lib/class.tcl
index c1291989aa0831af1986c30fff544d9f3678d5c3..88b056522a866b3acc9620218ec8dfae042d62a2 100644 (file)
--- a/lib/class.tcl
+++ b/lib/class.tcl
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