Index: TODO =================================================================== diff -u -r2ec475906a0ef436eebe94921b1a887c1a11d7cb -r2249341e24800ec7e78438717dbef8524dbb14be --- TODO (.../TODO) (revision 2ec475906a0ef436eebe94921b1a887c1a11d7cb) +++ TODO (.../TODO) (revision 2249341e24800ec7e78438717dbef8524dbb14be) @@ -2774,9 +2774,13 @@ "/cls/ class delete attribute name" * extended regression test +- added test cases for "info slots" + TODO: +- handle same-named per-object and provided slots for Class objects + - missing in c-based "info slots": * handle object specific "info slots" * regression tests (eg. "$cls class info slots" vs. "$cls info slots", "-closure") Index: library/nx/nx.tcl =================================================================== diff -u -r2ec475906a0ef436eebe94921b1a887c1a11d7cb -r2249341e24800ec7e78438717dbef8524dbb14be --- library/nx/nx.tcl (.../nx.tcl) (revision 2ec475906a0ef436eebe94921b1a887c1a11d7cb) +++ library/nx/nx.tcl (.../nx.tcl) (revision 2249341e24800ec7e78438717dbef8524dbb14be) @@ -551,7 +551,11 @@ if {[::nsf::object::exists $slotContainer]} { set cmd [list ::nsf::methods::object::info::children -type $type] if {[info exists pattern]} {lappend cmd $pattern} - return [$slotContainer {*}$cmd] + set result [list] + foreach slot [$slotContainer {*}$cmd] { + if {[$slot per-object]} { lappend result $slot } + } + return $result } } :alias "info vars" ::nsf::methods::object::info::vars Index: tests/info-method.test =================================================================== diff -u -rbd69e3a318c530a893bcf86b2d6d41f7064d3c07 -r2249341e24800ec7e78438717dbef8524dbb14be --- tests/info-method.test (.../info-method.test) (revision bd69e3a318c530a893bcf86b2d6d41f7064d3c07) +++ tests/info-method.test (.../info-method.test) (revision 2249341e24800ec7e78438717dbef8524dbb14be) @@ -274,9 +274,39 @@ ? {o mixin ""} "" } + # # test info slots / info lookup slots # +nx::Test case info-slots { + + nx::Class create C { + :attribute a + :attribute {b 1} + } + + nx::Class create D -superclass C { + :attribute {b 2} + :attribute c + :class attribute a2 + :method "sub foo" args {;} + :create d1 { + :attribute a3 + } + } + + ? {C info slots} "::C::slot::a ::C::slot::b" + ? {D class info slots} "::D::slot::a2" + ? {d1 info slots} "::d1::slot::a3" + # "a2" should not be included in the test cases below" + ? {D info slots} "::D::slot::b ::D::slot::a2 ::D::slot::c" + ? {d1 info lookup slots -source application} "::D::slot::b ::D::slot::a2 ::D::slot::c ::C::slot::a" + ? {D info slots -closure -source application} "::D::slot::b ::D::slot::a2 ::D::slot::c ::C::slot::a" +} + +# +# test info slots / info lookup slots +# nx::Test case slots { nx::Class create C {