Index: TODO =================================================================== diff -u -r53113de78cadfd4913718676222d6021d4e7a3fc -r2d609d0c01e236da96542cefab42d8c8f6a3d1e9 --- TODO (.../TODO) (revision 53113de78cadfd4913718676222d6021d4e7a3fc) +++ TODO (.../TODO) (revision 2d609d0c01e236da96542cefab42d8c8f6a3d1e9) @@ -5693,6 +5693,9 @@ /cls/ info method deprecated /obj/ info object method debug /obj/ info object method deprecated +- nx: added options "-debug" and "-deprecated" to methods "method" + and "obejct method", such one can use e.g. + C public method -deprecated bar {} {return 1} - extended regression test ======================================================================== @@ -5713,7 +5716,7 @@ ... info method debug ... which speaks rather for the 2nd approach for "info methods" -- add regression tests for debug and deprecated in methods (behavior + introspection) +- add regression tests for debug and deprecated in methods (behavior) - add regression tests for nsf::proc flags -debug and -deprecated (behavior) - add to doc: Index: library/nx/nx.tcl =================================================================== diff -u -r53113de78cadfd4913718676222d6021d4e7a3fc -r2d609d0c01e236da96542cefab42d8c8f6a3d1e9 --- library/nx/nx.tcl (.../nx.tcl) (revision 53113de78cadfd4913718676222d6021d4e7a3fc) +++ library/nx/nx.tcl (.../nx.tcl) (revision 2d609d0c01e236da96542cefab42d8c8f6a3d1e9) @@ -239,6 +239,7 @@ ###################################################################### ::nsf::method::create Class method { + -debug:switch -deprecated:switch name arguments:parameter,0..* -checkalways:switch -returns body } { set p [:__resolve_method_path $name] @@ -254,6 +255,8 @@ ::nsf::method::property $object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} } return $r } @@ -521,6 +524,7 @@ # - "forward" :public method "object method" { + -debug:switch -deprecated:switch methodName arguments:parameter,0..* -checkalways:switch -returns body } { set pathData [:__resolve_method_path -per-object $methodName] @@ -538,6 +542,8 @@ ::nsf::method::property $object $r call-protected \ [::nsf::dispatch $object __default_method_call_protection] if {[info exists returns]} {::nsf::method::property $object $r returns $returns} + if {$debug} {::nsf::method::property $object $r debug true} + if {$deprecated} {::nsf::method::property $object $r deprecated true} } return $r } Index: tests/methods.test =================================================================== diff -u -r53113de78cadfd4913718676222d6021d4e7a3fc -r2d609d0c01e236da96542cefab42d8c8f6a3d1e9 --- tests/methods.test (.../methods.test) (revision 53113de78cadfd4913718676222d6021d4e7a3fc) +++ tests/methods.test (.../methods.test) (revision 2d609d0c01e236da96542cefab42d8c8f6a3d1e9) @@ -1317,6 +1317,10 @@ } nx::test case debug+deprecated { + # + # Check setting and introspection of method properties "debug" and + # "deprecated" + # nx::Class create C { :public method foo {} {return 1} :public method bar {} {return 1} @@ -1325,16 +1329,29 @@ :public object method obar {} {return 1} } + ? {nsf::method::property C foo debug} 0 + ? {nsf::method::property C bar deprecated} 0 + ? {nsf::method::property C -per-object ofoo debug} 0 + ? {nsf::method::property C -per-object obar deprecated} 0 + ? {C info method debug foo} 0 ? {C info method deprecated bar} 0 ? {C info object method debug ofoo} 0 ? {C info object method deprecated obar} 0 - ? {nsf::method::property C foo debug 1} 1 - ? {nsf::method::property C bar deprecated 1} 1 - ? {nsf::method::property C -per-object ofoo debug 1} 1 - ? {nsf::method::property C -per-object obar deprecated 1} 1 + C eval { + :public method -debug foo {} {return 1} + :public method -deprecated bar {} {return 1} + + :public object method -debug ofoo {} {return 1} + :public object method -deprecated obar {} {return 1} + } + ? {nsf::method::property C foo debug} 1 + ? {nsf::method::property C bar deprecated} 1 + ? {nsf::method::property C -per-object ofoo debug} 1 + ? {nsf::method::property C -per-object obar deprecated} 1 + ? {C info method debug foo} 1 ? {C info method deprecated bar} 1 ? {C info object method debug ofoo} 1