Posted to tcl by dizach at Thu Jan 21 14:27:22 GMT 2010view raw
- proc ooRecreateMethod {class meth} {
- if {$meth in {create new} } return
- set fwd {}
- # catch "definition not available for this kind of method"
- if {[catch {
- set defs [info class definition $class $meth]
- } err]} {
- # see if this is because it's a forward
- if {[catch {info class forward $class $meth} fwd]} { set fwd {} }
- set defs [list {} {}]
- }
- foreach {arg scr} $defs {
- if {$fwd ne {}} {
- append txt "\tforward $meth $fwd\n"
- } else {
- append txt "\tmethod $meth [methodArgs $arg] {$scr}\n"
- }
- }
- return $txt
- }