diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-10-04 13:46:01 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-10-04 13:46:46 +1000 |
commit | a262aee64da817c03f3f1e9389489e4d33e1cfd5 (patch) | |
tree | 9f6af8f0909693506507e287530730e25d0454d6 /oo.tcl | |
parent | 84cf3d13ada8629693c5e8508b1323f5b379cfce (diff) | |
download | jimtcl-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.tcl | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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] } |