Index: TODO =================================================================== diff -u -rf67408d8e6f8ba9bdd6e4ec3c54dfa3a23576161 -r3e0565bde9f6f02b2145aecc8c1756c28d8ae507 --- TODO (.../TODO) (revision f67408d8e6f8ba9bdd6e4ec3c54dfa3a23576161) +++ TODO (.../TODO) (revision 3e0565bde9f6f02b2145aecc8c1756c28d8ae507) @@ -3365,7 +3365,13 @@ * extended regression test (next from -local, fully qualified names, private methods, "...dispatch -local") +- nx.tcl: + * make calls from "protected", "public", and "private" system calls, + such that "obj -system protected method foo {} ..." works, even + when obj has a method named "method". + * extended regression test + TODO: - private: * make it mutual exclusive with protected. Index: library/nx/nx.tcl =================================================================== diff -u -rfe1a8f6956a13ac6ce9f2df858b0c4d736840089 -r3e0565bde9f6f02b2145aecc8c1756c28d8ae507 --- library/nx/nx.tcl (.../nx.tcl) (revision fe1a8f6956a13ac6ce9f2df858b0c4d736840089) +++ library/nx/nx.tcl (.../nx.tcl) (revision 3e0565bde9f6f02b2145aecc8c1756c28d8ae507) @@ -246,7 +246,7 @@ if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { error "'[lindex $args 0]' is not a method defining method" } - set r [{*}:$args] + set r [::nsf::my -system {*}$args] if {$r ne ""} {::nsf::method::property [self] $r call-protected false} return $r } @@ -256,7 +256,7 @@ if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { error "'[lindex $args 0]' is not a method defining method" } - set r [{*}:$args] + set r [::nsf::my -system {*}$args] if {$r ne ""} {::nsf::method::property [self] $r call-protected true} return $r } @@ -266,7 +266,8 @@ if {![info exists ::nsf::methodDefiningMethod([lindex $args 0])]} { error "'[lindex $args 0]' is not a method defining method" } - set r [{*}:$args] + set r [::nsf::my -system {*}$args] + if {$r ne ""} {::nsf::method::property [self] $r call-private true} return $r } Index: tests/protected.test =================================================================== diff -u -rf67408d8e6f8ba9bdd6e4ec3c54dfa3a23576161 -r3e0565bde9f6f02b2145aecc8c1756c28d8ae507 --- tests/protected.test (.../protected.test) (revision f67408d8e6f8ba9bdd6e4ec3c54dfa3a23576161) +++ tests/protected.test (.../protected.test) (revision 3e0565bde9f6f02b2145aecc8c1756c28d8ae507) @@ -223,6 +223,7 @@ nx::Object create o1 { :public method info {} {return "overloads system info"} :public method destroy {} {return "overloads system destroy"} + :public method method args {return "overloads method method"} :variable v 1 } @@ -231,6 +232,9 @@ ? {o1 [nx::Object info method origin "info vars"]} "v" ? {o1 -system info vars} "v" ? {nsf::object::dispatch o1 -system info vars} "v" + + ? {o1 method foo {} {return foo}} "overloads method method" + ? {o1 -system public method foo {} {return foo}} "::o1::foo" ? {o1 destroy} "overloads system destroy" ? {nsf::object::exists o1} 1 @@ -309,8 +313,8 @@ ? {i1 foo2 4 5} 9 nx::Class create Sub -superclass Intermediate { - :public method bar {a b} { puts stderr "Sub.bar->local.baz";nsf::my -local baz $a $b } - :private method baz {a b} { puts stderr "Sub.private.baz";expr {$a * $b} } + :public method bar {a b} { nsf::my -local baz $a $b } + :private method baz {a b} { expr {$a * $b} } :create s1 }