aboutsummaryrefslogtreecommitdiff
path: root/oo.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2020-10-04 13:46:01 +1000
committerSteve Bennett <steveb@workware.net.au>2020-10-04 13:46:46 +1000
commita262aee64da817c03f3f1e9389489e4d33e1cfd5 (patch)
tree9f6af8f0909693506507e287530730e25d0454d6 /oo.tcl
parent84cf3d13ada8629693c5e8508b1323f5b379cfce (diff)
downloadjimtcl-a262aee64da817c03f3f1e9389489e4d33e1cfd5.zip
jimtcl-a262aee64da817c03f3f1e9389489e4d33e1cfd5.tar.gz
jimtcl-a262aee64da817c03f3f1e9389489e4d33e1cfd5.tar.bz2
oo: fix super for >2 levels of inheritance
Need to find the baseclass based on the current method class, not based on the object class. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'oo.tcl')
-rw-r--r--oo.tcl5
1 files changed, 3 insertions, 2 deletions
diff --git a/oo.tcl b/oo.tcl
index 54c10a5..616bc07 100644
--- a/oo.tcl
+++ b/oo.tcl
@@ -95,6 +95,7 @@ proc class {classname {baseclasses {}} classvars} {
# From within a method, invokes the given method on the base class.
# Note that this will only call the last baseclass given
proc super {method args} {
- upvar self self
- uplevel 2 [list [$self baseclass] $method {*}$args]
+ # If we are called from "class method", we want to call "[$class baseclass] method"
+ set classname [lindex [info level -1] 0 0]
+ uplevel 2 [list [$classname baseclass] $method {*}$args]
}