Index: TODO =================================================================== diff -u -r16a02881bff0a0d626d0045dfd96660338d0c314 -r07b40a4e9fcf594bd65394299372cd8c8556085f --- TODO (.../TODO) (revision 16a02881bff0a0d626d0045dfd96660338d0c314) +++ TODO (.../TODO) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) @@ -5654,9 +5654,17 @@ ... warning: nonnull argument ... compared to NULL ... The new macros turns off asserts, when gcc6 is used. +- new introspection methods: + "/obj/ info object method callprotection /m/" + "/cls/ info method callprotection /m/" +- extended regression test ======================================================================== TODO: +- add to doc: + info object method callprotection + info method callprotection + - gcc6: * ISOBJ(methodObj); will raise a warning, when methodObj is decared as nonnull * Same with ObjectName() and ClassName() Index: library/nx/nx.tcl =================================================================== diff -u -r3946480dcc906b5004bf18ee49b49054fa400e0d -r07b40a4e9fcf594bd65394299372cd8c8556085f --- library/nx/nx.tcl (.../nx.tcl) (revision 3946480dcc906b5004bf18ee49b49054fa400e0d) +++ library/nx/nx.tcl (.../nx.tcl) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) @@ -879,12 +879,22 @@ if {[info exists pattern]} {return [::nsf::parameter::filter $defs $pattern]} return $defs } - :method "info method syntax" {name} { + :method "info method syntax" {name} { return [string trimright "/cls/ [namespace tail $name] [: ::nsf::methods::class::info::method syntax $name]" { }] } - :method "info method type" {name} {: ::nsf::methods::class::info::method type $name} - :method "info method submethods" {name} {: ::nsf::methods::class::info::method submethods $name} - :method "info method returns" {name} {: ::nsf::methods::class::info::method returns $name} + :method "info method type" {name} {: ::nsf::methods::class::info::method type $name} + :method "info method submethods" {name} {: ::nsf::methods::class::info::method submethods $name} + :method "info method returns" {name} {: ::nsf::methods::class::info::method returns $name} + :method "info method callprotection" {name} { + if {[::nsf::method::property [self] $name call-protected]} { + puts stderr "YES" + return protected + } elseif {[::nsf::method::property [self] $name call-private]} { + return private + } else { + return public + } + } } Object eval { @@ -902,12 +912,21 @@ if {[info exists pattern]} {return [::nsf::parameter::filter $defs $pattern]} return $defs } - :method "info object method syntax" {name} { + :method "info object method syntax" {name} { return [string trimright "/obj/ [namespace tail $name] [: ::nsf::methods::object::info::method syntax $name]" { }] } - :method "info object method type" {name} {: ::nsf::methods::object::info::method type $name} - :method "info object method submethods" {name} {: ::nsf::methods::object::info::method submethods $name} - :method "info object method returns" {name} {: ::nsf::methods::object::info::method returns $name} + :method "info object method type" {name} {: ::nsf::methods::object::info::method type $name} + :method "info object method submethods" {name} {: ::nsf::methods::object::info::method submethods $name} + :method "info object method returns" {name} {: ::nsf::methods::object::info::method returns $name} + :method "info object method callprotection" {name} { + if {[::nsf::method::property [self] -per-object $name call-protected]} { + return protected + } elseif {[::nsf::method::property [self] -per-object $name call-private]} { + return private + } else { + return public + } + } } ###################################################################### Index: tests/method-parameter.test =================================================================== diff -u -r56f4f317c47da838e5ba90bba28d0c14b11f2392 -r07b40a4e9fcf594bd65394299372cd8c8556085f --- tests/method-parameter.test (.../method-parameter.test) (revision 56f4f317c47da838e5ba90bba28d0c14b11f2392) +++ tests/method-parameter.test (.../method-parameter.test) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) @@ -107,7 +107,7 @@ nx::test case flag-in-ensemble { nx::Class create C - set info {info children, info class, info filters, info has mixin, info has namespace, info has type, info heritage, info info, info instances, info lookup filter, info lookup filters, info lookup method, info lookup methods, info lookup mixins, info lookup parameters, info lookup slots, info lookup syntax, info lookup variables, info method args, info method body, info method definition, info method definitionhandle, info method exists, info method handle, info method origin, info method parameters, info method registrationhandle, info method returns, info method submethods, info method syntax, info method type, info methods, info mixinof, info mixins, info name, info object filters, info object method args, info object method body, info object method definition, info object method definitionhandle, info object method exists, info object method handle, info object method origin, info object method parameters, info object method registrationhandle, info object method returns, info object method submethods, info object method syntax, info object method type, info object methods, info object mixins, info object slots, info object variables, info parent, info precedence, info slots, info subclasses, info superclasses, info variable definition, info variable name, info variable parameter, info variables, info vars} + set info {info children, info class, info filters, info has mixin, info has namespace, info has type, info heritage, info info, info instances, info lookup filter, info lookup filters, info lookup method, info lookup methods, info lookup mixins, info lookup parameters, info lookup slots, info lookup syntax, info lookup variables, info method args, info method body, info method callprotection, info method definition, info method definitionhandle, info method exists, info method handle, info method origin, info method parameters, info method registrationhandle, info method returns, info method submethods, info method syntax, info method type, info methods, info mixinof, info mixins, info name, info object filters, info object method args, info object method body, info object method callprotection, info object method definition, info object method definitionhandle, info object method exists, info object method handle, info object method origin, info object method parameters, info object method registrationhandle, info object method returns, info object method submethods, info object method syntax, info object method type, info object methods, info object mixins, info object slots, info object variables, info parent, info precedence, info slots, info subclasses, info superclasses, info variable definition, info variable name, info variable parameter, info variables, info vars} ? {C info superclasses} "::nx::Object" ? {C info -a superclass} "unable to dispatch sub-method \"-a\" of ::C info; valid are: $info" Index: tests/methods.test =================================================================== diff -u -r0f881e4bc45e927c8d84c1b1b468ef7537cb9b03 -r07b40a4e9fcf594bd65394299372cd8c8556085f --- tests/methods.test (.../methods.test) (revision 0f881e4bc45e927c8d84c1b1b468ef7537cb9b03) +++ tests/methods.test (.../methods.test) (revision 07b40a4e9fcf594bd65394299372cd8c8556085f) @@ -64,15 +64,37 @@ :public object alias public_object_alias [:info object method registrationhandle public_object_method] :protected object alias protected_object_alias [:info object method registrationhandle protected_object_method] } + + C property -accessor public s0 C property -accessor protected s1 ? {c1 s0 set 0} 0 ? {::nsf::dispatch c1 s1 set 1} 1 C object property -accessor public {s3 ""} ? {C s3 set 3} 3 + +nx::test case info-callprotection { + ? {C info method callprotection plain_method} "public" + ? {C info method callprotection protected_method} "protected" + ? {C info method callprotection public_method} "public" + + ? {C info method callprotection plain_alias} "public" + ? {C info method callprotection protected_alias} "protected" + ? {C info method callprotection public_alias} "public" + + ? {C info object method callprotection plain_object_method} "public" + ? {C info object method callprotection protected_object_method} "protected" + ? {C info object method callprotection public_object_method} "public" + + ? {C info object method callprotection plain_object_alias} "public" + ? {C info object method callprotection protected_object_alias} "protected" + ? {C info object method callprotection public_object_alias} "public" +} + # create a fresh object (different from c1) C create c2 + # test scripted class level methods nx::test case scripted-class-level-methods { ? {c2 plain_method} "plain_method"