Index: TODO =================================================================== diff -u -r693aa83247d37e11744c0a442ec10b22d218db9f -r0054815a6f649a06f4e3a9f5516df56c05e99098 --- TODO (.../TODO) (revision 693aa83247d37e11744c0a442ec10b22d218db9f) +++ TODO (.../TODO) (revision 0054815a6f649a06f4e3a9f5516df56c05e99098) @@ -1334,6 +1334,9 @@ - new functions: GetRegObject() - extended regression test +- fixed handles with subcommands used on objects without namespaces +- new functions: GetRegObject() + TODO: - /* TODO: what, if we call on a class "info method" with a methodhandle of an object? */ - check potential crashes with invalid input Index: generic/nsf.c =================================================================== diff -u -r693aa83247d37e11744c0a442ec10b22d218db9f -r0054815a6f649a06f4e3a9f5516df56c05e99098 --- generic/nsf.c (.../nsf.c) (revision 693aa83247d37e11744c0a442ec10b22d218db9f) +++ generic/nsf.c (.../nsf.c) (revision 0054815a6f649a06f4e3a9f5516df56c05e99098) @@ -1123,7 +1123,7 @@ cmd = Tcl_GetCommandFromObj(interp, name); *fromClassNS = IsClassNsName(nameString); } else { - cmd = FindMethod(nsPtr, nameString); + cmd = nsPtr ? FindMethod(nsPtr, nameString) : NULL; } if (cmd) { @@ -1203,7 +1203,7 @@ NsfObject *referencedObject; char* methodName = ObjStr(methodObj); - if (nsPtr && strchr(methodName, ' ') > 0) { + if (strchr(methodName, ' ') > 0) { Tcl_Obj *methodHandleObj; Tcl_Obj **ov; int oc, result, i; @@ -14523,6 +14523,7 @@ Tcl_DStringInit(dsPtr); cmd = ResolveMethodName(interp, object->nsPtr, methodNameObj, dsPtr, ®Object, &defObject, &methodName1, &fromClassNS); + /*fprintf(stderr, "object %p regObject %p defObject %p\n",object,regObject,defObject);*/ result = ListMethod(interp, regObject ? regObject : object, defObject ? defObject : object, Index: tests/info-method.tcl =================================================================== diff -u -r8f05e6491f0ce991406f502b7c8c6f960f4c2140 -r0054815a6f649a06f4e3a9f5516df56c05e99098 --- tests/info-method.tcl (.../info-method.tcl) (revision 8f05e6491f0ce991406f502b7c8c6f960f4c2140) +++ tests/info-method.tcl (.../info-method.tcl) (revision 0054815a6f649a06f4e3a9f5516df56c05e99098) @@ -203,6 +203,7 @@ :method "foo a" {} {return a} :method "foo b" {x:int y:upper} {return b} } + nx::Object create o2 nx::Class create C { :method "bar a" {} {return a} @@ -217,9 +218,15 @@ # query definition on subcommand with handle ? {o info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} - # query definition on handle of ensemble object - ? {o info method definition "::o::foo::b"} {::o::foo method b {x:int y:upper} {return b}} + # query definition on subcommand with handle + ? {o info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + # query definition on subcommand with handle called on different object + ? {o2 info method definition "::o::foo b"} {::o method {foo b} {x:int y:upper} {return b}} + + # query definition on handle of ensemble object called on different object + ? {o2 info method definition "::o::foo::b"} {::o::foo method b {x:int y:upper} {return b}} + # query definition on subcommand of class ? {::nx::Object info method definition "info lookup methods"} \ {::nx::Object alias {info lookup methods} ::nsf::cmd::ObjectInfo::lookupmethods} @@ -228,7 +235,7 @@ ? {o info method definition "::nsf::classes::nx::Object::info lookup methods"} \ {::nx::Object alias {info lookup methods} ::nsf::cmd::ObjectInfo::lookupmethods} - # query definition on ensemble object of class + # query definition on handle of ensemble object of class ? {o info method definition "::nx::Object::slot::__info::lookup::methods"} \ {::nx::Object::slot::__info::lookup alias methods ::nsf::cmd::ObjectInfo::lookupmethods}