Index: TODO =================================================================== diff -u -re367957430bf9246069791785619a5503e166d33 -rccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd --- TODO (.../TODO) (revision e367957430bf9246069791785619a5503e166d33) +++ TODO (.../TODO) (revision ccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd) @@ -5756,6 +5756,8 @@ (handling NSF_EVAL_DEBUG, NSF_EVAL_LOG, NSF_EVAL_DEPRECATED) - added regression tests for potential recursive calls +- added flags "-debug" and "-deprecated" to XOTcl 2 "instproc", "proc", + "instforward" and "forward" methods ======================================================================== TODO: - add regression tests for debug and deprecated in methods (behavior) Index: library/nx/nx.tcl =================================================================== diff -u -r8cbd921f522b6950968c5c2cb36b2fb3463a4dbb -rccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd --- library/nx/nx.tcl (.../nx.tcl) (revision 8cbd921f522b6950968c5c2cb36b2fb3463a4dbb) +++ library/nx/nx.tcl (.../nx.tcl) (revision ccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd) @@ -351,9 +351,9 @@ Class public method forward { -debug:switch -deprecated:switch - methodName - -default -prefix -frame -onerror -returns -verbose:switch - target:optional args + methodName + -default -prefix -frame -onerror -returns -verbose:switch + target:optional args } { set pathData [:__resolve_method_path $methodName] set arguments [lrange [::nsf::current args] 1 end] Index: library/xotcl/library/xotcl2.tcl =================================================================== diff -u -r3946480dcc906b5004bf18ee49b49054fa400e0d -rccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd --- library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision 3946480dcc906b5004bf18ee49b49054fa400e0d) +++ library/xotcl/library/xotcl2.tcl (.../xotcl2.tcl) (revision ccca1a502b5c9b77ecfd8ce16c59d77b14f0ccfd) @@ -310,32 +310,46 @@ # define instproc and proc ::nsf::method::create Class instproc { + -debug:switch -deprecated:switch name arguments:parameter,0..* body precondition:optional postcondition:optional } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::nsf::method::create [self] $name $arguments $body {*}$conditions + set r [::nsf::method::create [self] $name $arguments $body {*}$conditions] + if {$debug} {::nsf::method::property [self] $r debug true} + if {$deprecated} {::nsf::method::property [self] $r deprecated true} + return $r } ::nsf::method::create Object proc { + -debug:switch -deprecated:switch name arguments body precondition:optional postcondition:optional } { set conditions [list] if {[info exists precondition]} {lappend conditions -precondition $precondition} if {[info exists postcondition]} {lappend conditions -postcondition $postcondition} - ::nsf::method::create [self] -per-object $name $arguments $body {*}$conditions + set r [::nsf::method::create [self] -per-object $name $arguments $body {*}$conditions] + if {$debug} {::nsf::method::property [self] $r debug true} + if {$deprecated} {::nsf::method::property [self] $r deprecated true} + return $r } # define a minimal implementation of "method" - Object instproc method {name arguments:parameter,0..* body} { - :proc $name $arguments $body + Object instproc method { + -debug:switch -deprecated:switch + name arguments:parameter,0..* body + } { + :proc -debug=$debug -deprecated=$deprecated $name $arguments $body } - Class instproc method {-per-object:switch name arguments:parameter,0..* body} { + Class instproc method { + -debug:switch -deprecated:switch + -per-object:switch name arguments:parameter,0..* body + } { if {${per-object}} { - :proc $name $arguments $body + :proc -debug=$debug -deprecated=$deprecated $name $arguments $body } else { - :instproc $name $arguments $body + :instproc -debug=$debug -deprecated=$deprecated $name $arguments $body } } @@ -350,6 +364,7 @@ # have to provide the definition the hard way via methods. Object instproc forward { + -debug:switch -deprecated:switch method -default -earlybinding:switch -methodprefix -objscope:switch -onerror -verbose:switch target:optional args @@ -367,10 +382,13 @@ if {[info exists target]} {lappend arglist $target} if {[llength $args] > 0} {lappend arglist {*}$args} set r [::nsf::method::forward [self] -per-object $method {*}$arglist] + if {$debug} {::nsf::method::property [self] $r debug true} + if {$deprecated} {::nsf::method::property [self] $r deprecated true} return $r } Class instproc instforward { + -debug:switch -deprecated:switch method -default -earlybinding:switch -methodprefix -objscope:switch -onerror -verbose:switch target:optional args @@ -388,6 +406,8 @@ if {[info exists target]} {lappend arglist $target} if {[llength $args] > 0} {lappend arglist {*}$args} set r [::nsf::method::forward [self] $method {*}$arglist] + if {$debug} {::nsf::method::property [self] $r debug true} + if {$deprecated} {::nsf::method::property [self] $r deprecated true} return $r }