Index: TODO =================================================================== diff -u -r4b8cf86fbf103e2d7a014a4942a6486fb77ebd39 -r451c0d385a7b952b55d12fd02895dfc5ba342293 --- TODO (.../TODO) (revision 4b8cf86fbf103e2d7a014a4942a6486fb77ebd39) +++ TODO (.../TODO) (revision 451c0d385a7b952b55d12fd02895dfc5ba342293) @@ -1156,8 +1156,11 @@ - updated migration guide - changed info to new interface (partly done for nx, migration for xotcl to be done) +- fixed "info methods" and added "-methodtype all" for setting class-only +- regression test works now until first XOTcl reference TODO: +- overthink decision about not showing "child objects" per default in "info methods" - continue migration nx in regression test - change info in XOTcl to new interface - copy info methods to source Index: library/nx/nx.tcl =================================================================== diff -u -radc4affd14701109f5d9b655dddf58d6b42cd781 -r451c0d385a7b952b55d12fd02895dfc5ba342293 --- library/nx/nx.tcl (.../nx.tcl) (revision adc4affd14701109f5d9b655dddf58d6b42cd781) +++ library/nx/nx.tcl (.../nx.tcl) (revision 451c0d385a7b952b55d12fd02895dfc5ba342293) @@ -1886,7 +1886,7 @@ ####################################################### #puts stderr Class-methods=[lsort [Class info methods]] - foreach m [Class info methods] { + foreach m [Class info methods -methodtype all] { ::nsf::methodproperty Class $m class-only true } Index: tests/info-method.tcl =================================================================== diff -u -re849d060161385466c782e46c19344428934cd7f -r451c0d385a7b952b55d12fd02895dfc5ba342293 --- tests/info-method.tcl (.../info-method.tcl) (revision e849d060161385466c782e46c19344428934cd7f) +++ tests/info-method.tcl (.../info-method.tcl) (revision 451c0d385a7b952b55d12fd02895dfc5ba342293) @@ -1,73 +1,74 @@ package req nx package require nx::test -nx::Object create o { - :alias set ::set -} +Test case base { + nx::Object create o { + :alias set ::set + } -nx::Class create C { - :method m {x} {return proc-[self proc]} - :object method mpo {} {return instproc-[self proc]} - :method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2 - - :forward addOne expr 1 + - :object forward add1 expr 1 + - :object forward fpo ::o - - :setter s - :object setter spo - - :alias a ::set - :object alias apo ::puts + nx::Class create C { + :method m {x} {return proc-[self proc]} + :object method mpo {} {return instproc-[self proc]} + :method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2 + + :forward addOne expr 1 + + :object forward add1 expr 1 + + :object forward fpo ::o + + :setter s + :object setter spo + + :alias a ::set + :object alias apo ::puts + } + C create c1 + + ? {lsort [C info methods -callprotection all]} "a addOne m m-with-assertions s" + #? {lsort [C info methods]} "a addOne s" + foreach m [lsort [C info methods -callprotection all]] { + ? [subst -nocommands {lsort [c1 info callable methods $m]}] $m + } + ? {C info method definition a} "::C alias a ::set" + ? {c1 info callable method a} "::nsf::classes::C::a" + ? {c1 info callable method addOne} "::nsf::classes::C::addOne" + ? {c1 info callable method m} "::nsf::classes::C::m" + ? {c1 info callable method s} "::nsf::classes::C::s" + c1 method foo {} {puts foo} + ? {c1 info method definition foo} "::c1 method foo {} {puts foo}" + ? {c1 info callable method foo} "::c1::foo" + + ? {C info method handle m} "::nsf::classes::C::m" + ? {C object info method handle mpo} "::C::mpo" + + ? {C info method definition m} {::C method m x {return proc-[self proc]}} + ? {C info method def m} {::C method m x {return proc-[self proc]}} + ? {C object info method definition mpo} {::C object method mpo {} {return instproc-[self proc]}} + ? {C info method definition m-with-assertions} \ + {::C method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} + ? {C info method parameter m} {x} + ? {nx::Class info method parameter method} \ + {name arguments body -precondition -postcondition} + ? {nx::Object info method parameter alias} \ + {-nonleaf:switch -objscope:switch methodName cmd} + # raises currently an error + ? {catch {C info method parameter a}} 1 + + ? {C info method definition addOne} "::C forward addOne expr 1 +" + ? {C object info method definition add1} "::C object forward add1 expr 1 +" + ? {C object info method definition fpo} "::C object forward fpo ::o" + + ? {C info method definition s} "::C setter s" + ? {C object info method definition spo} "::C object setter spo" + + ? {C info method definition a} "::C alias a ::set" + ? {C object info method definition apo} "::C object alias apo ::puts" + + ? {::nx::Object info callable methods -application} "" + ? {::nx::Class info callable methods -application} "" + ? {lsort [C info callable methods -application]} "add1 apo fpo mpo spo" + ? {lsort [c1 info callable methods -application]} "a addOne foo m m-with-assertions s" } -C create c1 -? {lsort [C info methods -callprotection all]} "a addOne m m-with-assertions s" -#? {lsort [C info methods]} "a addOne s" -foreach m [lsort [C info methods -callprotection all]] { - ? [subst -nocommands {lsort [c1 info callable methods $m]}] $m -} -? {C info method definition a} "::C alias a ::set" -? {c1 info callable method a} "::nsf::classes::C::a" -? {c1 info callable method addOne} "::nsf::classes::C::addOne" -? {c1 info callable method m} "::nsf::classes::C::m" -? {c1 info callable method s} "::nsf::classes::C::s" -c1 method foo {} {puts foo} -? {c1 info method definition foo} "::c1 method foo {} {puts foo}" -? {c1 info callable method foo} "::c1::foo" - -? {C info method handle m} "::nsf::classes::C::m" -? {C object info method handle mpo} "::C::mpo" - -? {C info method definition m} {::C method m x {return proc-[self proc]}} -? {C info method def m} {::C method m x {return proc-[self proc]}} -? {C object info method definition mpo} {::C object method mpo {} {return instproc-[self proc]}} -? {C info method definition m-with-assertions} \ - {::C method m-with-assertions {} {return proc-[self proc]} -precondition 1 -postcondition 2} -? {C info method parameter m} {x} -? {nx::Class info method parameter method} \ - {name arguments body -precondition -postcondition} -? {nx::Object info method parameter alias} \ - {-nonleaf:switch -objscope:switch methodName cmd} -# raises currently an error -? {catch {C info method parameter a}} 1 - -? {C info method definition addOne} "::C forward addOne expr 1 +" -? {C object info method definition add1} "::C object forward add1 expr 1 +" -? {C object info method definition fpo} "::C object forward fpo ::o" - -? {C info method definition s} "::C setter s" -? {C object info method definition spo} "::C object setter spo" - -? {C info method definition a} "::C alias a ::set" -? {C object info method definition apo} "::C object alias apo ::puts" - - -? {::nx::Object info callable methods -application} "" -? {::nx::Class info callable methods -application} "" -? {lsort [C info callable methods -application]} "add1 apo fpo mpo spo" -? {lsort [c1 info callable methods -application]} "a addOne foo m m-with-assertions s" - Test case callable { # define the same method for Object and Class ::nx::Object method bar {} {return Object.bar}