From a262aee64da817c03f3f1e9389489e4d33e1cfd5 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 4 Oct 2020 13:46:01 +1000 Subject: 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 --- oo.tcl | 5 +++-- 1 file 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] } -- cgit v1.1