Index: TODO =================================================================== diff -u -rdc2dc691003a7afa24a9c4ec72f91ece7a10d804 -r440e05aa8a59891a119c4fd5fa3ad4193cedd9a3 --- TODO (.../TODO) (revision dc2dc691003a7afa24a9c4ec72f91ece7a10d804) +++ TODO (.../TODO) (revision 440e05aa8a59891a119c4fd5fa3ad4193cedd9a3) @@ -1196,7 +1196,7 @@ - extended regression tests (call unknown method with filter with and without unknown handlers) - make sure to test next to non-existing shadowed - method in connections with filters and unknwon handlers + method in connections with filters and unknown handlers - documented incompatiblity of object-invocation via method interface (due to ensemble objects) in migration guide @@ -1817,10 +1817,10 @@ - allowed public|protected for method deletion such as "Object public method foo {} {}" - removed defaultMethodCallProtection in alias test +- extended regression tests for aliases to procs TODO: -- add tests for proc-alias - add test for destroy-during-init - handling of msg in NsfCleanupObject - handling of msg in CscFinish Index: tests/aliastest.tcl =================================================================== diff -u -rdc2dc691003a7afa24a9c4ec72f91ece7a10d804 -r440e05aa8a59891a119c4fd5fa3ad4193cedd9a3 --- tests/aliastest.tcl (.../aliastest.tcl) (revision dc2dc691003a7afa24a9c4ec72f91ece7a10d804) +++ tests/aliastest.tcl (.../aliastest.tcl) (revision 440e05aa8a59891a119c4fd5fa3ad4193cedd9a3) @@ -483,3 +483,63 @@ ? {d1 bar2} 1 } + +proc foo {:a :b} { + set :c 1 + return ${:a} +} +foo 1 2 + +proc bar {:a :b} { + set :b 1 + set :x 47 + return [info exists :d]-${:a}-${:x} +} + +proc baz {} { + set :z 3 + return ${:z} +} + +Test parameter count 10 +Test case proc-alias-compile { + + Object create o { + set :a 100 + set :d 1001 + #:method foo {-:a:integer :b :c:optional} { + # puts stderr ${:a},${:b},${:c} + #} + :public alias foo ::foo + :public alias bar ::bar + :public alias baz ::baz + } + + # + # by calling "foo" outside the obejct/method context, we get a + # byte-code without the compiled-local handler, colon-vars are not + # recognized, :a refers to the argument + ? {foo 1 2} 1 + ? {lsort [o info vars]} "a d" + + ? {o foo 1 2} 1 + ? {lsort [o info vars]} "a d" + + # + # by calling "bar" the first time as a method, we get a byte-code with + # the compiled-local handler, colon-vars are recognized, colon vars + # from the argument vector have precedence over instance variables. + ? {o bar 2 3} 1-2-47 + ? {lsort [o info vars]} "a d x" + + ? {o baz} 3 + ? {lsort [o info vars]} "a d x z" + # + # by calling "bar" outside the proc context, the compiled-var-fetch + # has no object to refer to, the variable is unknown. + ? {bar 3 4} 0-3-47 + + # the variable in the test scope does not influence result + set :d 200 + ? {bar 3 4} 0-3-47 +} \ No newline at end of file