Index: tests/protected.test =================================================================== diff -u -N -r7d3bc964348a674a9d80ab8751f1f827dbd6b7b9 -rcb838e0d7ecf616891cc1f5089750208913d8503 --- tests/protected.test (.../protected.test) (revision 7d3bc964348a674a9d80ab8751f1f827dbd6b7b9) +++ tests/protected.test (.../protected.test) (revision cb838e0d7ecf616891cc1f5089750208913d8503) @@ -27,7 +27,7 @@ ::nsf::method::property C SET call-protected true ? {c1 SET x 1} {::c1: unable to dispatch method 'SET'} - ? {::nsf::object::dispatch c1 SET x 2} {2} "dispatch of protected methods works" + ? {nx::dispatch c1 SET x 2} {2} "dispatch of protected methods works" ? {c1 foo} {foo} ? {c1 bar} {bar} ? {c1 bar-SET} {1} @@ -37,7 +37,7 @@ ::nsf::method::property C foo call-protected true ? {c1 SET x 1} {::c1: unable to dispatch method 'SET'} - ? {::nsf::object::dispatch c1 SET x 2} {2} "dispatch of protected methods works" + ? {nx::dispatch c1 SET x 2} {2} "dispatch of protected methods works" ? {c1 bar} {bar} "other method work" ? {c1 foo} {::c1: unable to dispatch method 'foo'} ? {c1 bar-SET} {1} "internal call of protected C implementend method" @@ -54,7 +54,7 @@ ? {::nsf::method::property C foo call-protected} 0 ? {c1 SET x 3} 3 - ? {::nsf::object::dispatch c1 SET x 2} {2} + ? {nx::dispatch c1 SET x 2} {2} ? {c1 foo} {foo} ? {c1 bar} {bar} ? {c1 bar-SET} {1} @@ -67,7 +67,7 @@ ? {::nsf::method::property C SET call-protected} 0 ? {c1 SET x 3} 3 - ? {::nsf::object::dispatch c1 SET x 4} {4} + ? {nx::dispatch c1 SET x 4} {4} ? {c1 foo} {::c1: unable to dispatch method 'foo'} ? {c1 bar} {bar} ? {c1 bar-SET} {1} @@ -183,8 +183,8 @@ # methods are defined as private to avoid interference. # nx::Class create M { - :public method foo {} {nsf::my -local bar} - :private method bar {} {nsf::my -local baz} + :public method foo {} {my -local bar} + :private method bar {} {my -local baz} :private method baz {} {return "M.baz"} } @@ -214,17 +214,17 @@ :public method bar {} {return "B.bar [next]"} :public method baz {} {return "B.baz [next]"} :create b1 { - :public method foo {} {nsf::my -local bar} - :private method bar {} {nsf::my -local baz} + :public method foo {} {my -local bar} + :private method bar {} {my -local baz} :private method baz {} {return "b1.baz"} } } nx::Class create C -superclass B { :public method bar {} {return "C.bar [next]"} :public method baz {} {return "C.baz [next]"} :create c1 { - :public method foo {} {nsf::my -local bar} - :private method bar {} {nsf::my -local baz} + :public method foo {} {my -local bar} + :private method bar {} {my -local baz} :private method baz {} {return "c1.baz"} } } @@ -265,7 +265,7 @@ nx::Test case local+filter { nx::Class create C { :method f1 args { return "f1 [next]" } - :public method foo {} { return "C.foo [nsf::my -local bar]"} + :public method foo {} { return "C.foo [my -local bar]"} :private method bar {} { return "bar"} :public method baz {} { return "C.baz [next]"} } @@ -354,8 +354,8 @@ # add on B calls to local C eval { - :public method q1 {} {nsf::my -local p1} - :public method q3 {} {nsf::my -local p3} + :public method q1 {} {my -local p1} + :public method q3 {} {my -local p3} } # all chains start with C, since local resolve works ? {c1 q1} "C.p1 " @@ -368,35 +368,32 @@ # calls via method handles allows us to dispatch private methods, # results like "-local" resolves above - ? {nsf::object::dispatch c1 [C info method handle p1]} "C.p1 " - ? {nsf::object::dispatch c1 [C info method handle p3]} "C.p3 B.p3" + ? {nx::dispatch c1 [C info method handle p1]} "C.p1 " + ? {nx::dispatch c1 [C info method handle p3]} "C.p3 B.p3" # we can't call the private method via dispatch, since the private # methods are removed from the search for methods - ? {nsf::object::dispatch c1 p1} "::c1: unable to dispatch method 'p1'" - ? {nsf::object::dispatch c1 p3} "B.p3" + ? {nx::dispatch c1 p1} "::c1: unable to dispatch method 'p1'" + ? {nx::dispatch c1 p3} "B.p3" # via dispatch, the local flag uses (as always) the context of the # currently execting class, which is not provided below - ? {nsf::object::dispatch c1 -local p1} "::c1: unable to dispatch method 'p1'" - + ? {nx::dispatch c1 -local p1} "::c1: unable to dispatch method 'p1'" } - - # -# test "nsf::my -local" on classes +# test "my -local" on classes # nx::Test case class-my-local { nx::Class create Base { :private method baz {a b} { expr {$a + $b} } - :public method foo {a b} { nsf::my -local baz $a $b } + :public method foo {a b} { my -local baz $a $b } } nx::Class create Sub -superclass Base { - :public method bar {a b} { nsf::my -local baz $a $b } + :public method bar {a b} { my -local baz $a $b } :private method baz {a b} { expr {$a * $b} } :create s1 @@ -408,7 +405,7 @@ } # -# test "nsf::my -local" on objects +# test "my -local" on objects # nx::Test case object-my-local { nx::Class create M { @@ -418,7 +415,7 @@ nx::Object create o1 { :protected method foo {} {return o1} :public method foo2 {} {:foo} - :public method bar {} {nsf::my -local foo} + :public method bar {} {my -local foo} } ? {o1 foo} {::o1: unable to dispatch method 'foo'} @@ -434,17 +431,17 @@ } # -# test nsf::my + path instead of "nsf::my -local" on classes +# test "my" + path instead of "my -local" on classes # nx::Test case my+handle-instead-of-my-local { nx::Class create Base { :private method privateMethod {a b} { expr {$a + $b} } - :public method foo {a b} { nsf::my [Base info method handle privateMethod] $a $b } + :public method foo {a b} { my [Base info method handle privateMethod] $a $b } } nx::Class create Sub -superclass Base { - :public method bar {a b} { nsf::my [Sub info method handle privateMethod] $a $b } + :public method bar {a b} { my [Sub info method handle privateMethod] $a $b } :private method privateMethod {a b} { expr {$a * $b} } :create s1 @@ -455,17 +452,17 @@ } # -# test object::dispatch instead of "nsf::my -local" on classes +# test object::dispatch instead of "my -local" on classes # nx::Test case dispatch-instead-of-my-local { nx::Class create Base { :private method privateMethod {a b} { expr {$a + $b} } - :public method foo {a b} { nsf::object::dispatch [self] [Base info method handle privateMethod] $a $b } + :public method foo {a b} { dispatch [self] [Base info method handle privateMethod] $a $b } } nx::Class create Sub -superclass Base { - :public method bar {a b} { nsf::object::dispatch [self] [Sub info method handle privateMethod] $a $b } + :public method bar {a b} { dispatch [self] [Sub info method handle privateMethod] $a $b } :private method privateMethod {a b} { expr {$a * $b} } :create s1 @@ -494,16 +491,16 @@ ? {o1 ::nx::Object::slot::__info::vars} "v" ? {o1 [nx::Object info method origin "info vars"]} "v" #? {o1 -system info vars} "v" - ? {nsf::object::dispatch o1 -system info vars} "v" + ? {nx::dispatch o1 -system info vars} "v" #? {o1 -system} "no method name specified" ? {o1 method foo {} {return foo}} "overloads method method" - ? {nsf::object::dispatch o1 -system public method foo {} {return foo}} "::o1::foo" + ? {nx::dispatch o1 -system public method foo {} {return foo}} "::o1::foo" ? {o1 destroy} "overloads system destroy" ? {nsf::object::exists o1} 1 - ? {nsf::object::dispatch o1 -system destroy} "" + ? {nx::dispatch o1 -system destroy} "" ? {nsf::object::exists o1} 0 # @@ -520,12 +517,12 @@ ? {c1 ::nx::Object::slot::__info::vars} "v" ? {c1 [nx::Object info method origin "info vars"]} "v" #? {c1 -system info vars} "v" - ? {nsf::object::dispatch c1 -system info vars} "v" + ? {nx::dispatch c1 -system info vars} "v" ? {c1 destroy} "overloads system destroy" ? {nsf::object::exists c1} 1 #? {c1 -system destroy} "" - ? {nsf::object::dispatch c1 -system destroy} "" + ? {nx::dispatch c1 -system destroy} "" ? {nsf::object::exists c1} 0 } @@ -541,7 +538,7 @@ nx::Class create Base { :private method baz {a b} { expr {$a + $b} } :protected method baz2 {a b} { expr {$a + $b} } - :public method foo {a b} { nsf::my -local baz $a $b } + :public method foo {a b} { my -local baz $a $b } :create b1 } # we can call Base.baz only through Base.foo @@ -552,7 +549,7 @@ # private method via "my -local" nx::Class create Mix { :private method baz {a b} { expr {$a ** $b} } - :public method foo {a b} { nsf::my -local baz $a $b } + :public method foo {a b} { my -local baz $a $b } } b1 mixin add Mix @@ -567,8 +564,8 @@ nx::Class create Intermediate -superclass Base { :private method baz {a b} { next } :private method baz2 {a b} { next } - :public method foo {a b} { nsf::my -local baz $a $b } - :public method foo2 {a b} { nsf::my -local baz2 $a $b } + :public method foo {a b} { my -local baz $a $b } + :public method foo2 {a b} { my -local baz2 $a $b } :create i1 } @@ -579,7 +576,7 @@ ? {i1 foo2 4 5} 9 nx::Class create Sub -superclass Intermediate { - :public method bar {a b} { nsf::my -local baz $a $b } + :public method bar {a b} { my -local baz $a $b } :private method baz {a b} { expr {$a * $b} } :create s1