Index: TODO =================================================================== diff -u -r0e4ebdb092c8158987489b5c26cf11526b2756f5 -r0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa --- TODO (.../TODO) (revision 0e4ebdb092c8158987489b5c26cf11526b2756f5) +++ TODO (.../TODO) (revision 0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa) @@ -5155,6 +5155,11 @@ "info parameter" was not object/class specific at all, but is just a syntax extractor + +nsf.c: +- extend nsf::parameter::get to obtained more detailed information + for obejcts/classes/metaclasses/baseclasses and specified types +- extend regression test ======================================================================== TODO: Index: generic/nsf.c =================================================================== diff -u -reea18b07ddfc917545d48ab6a272c0bfb9656f07 -r0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa --- generic/nsf.c (.../nsf.c) (revision eea18b07ddfc917545d48ab6a272c0bfb9656f07) +++ generic/nsf.c (.../nsf.c) (revision 0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa) @@ -25004,10 +25004,32 @@ case ParametersubcmdTypeIdx: if (paramsPtr->type) { + if (paramsPtr->converter == Nsf_ConvertToTclobj && paramsPtr->converterArg) { Tcl_SetObjResult(interp, paramsPtr->converterArg); + } else { - Tcl_SetObjResult(interp, Tcl_NewStringObj(paramsPtr->type, -1)); + if (paramsPtr->converter == Nsf_ConvertToObject || paramsPtr->converter == Nsf_ConvertToClass) { + CONST char *what = paramsPtr->type; + /* + * baseclass and metaclass are communicated via flags + */ + if (unlikely(paramsPtr->flags & NSF_ARG_BASECLASS)) { + what = "baseclass"; + } else if (unlikely(paramsPtr->flags & NSF_ARG_METACLASS)) { + what = "metaclass"; + } + /* + * The converterArg might contain a class for type checking + */ + if (paramsPtr->converterArg == NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj(what, -1)); + } else { + NsfPrintError(interp, "%s,type=%s", what, ObjStr(paramsPtr->converterArg)); + } + } else { + Tcl_SetObjResult(interp, Tcl_NewStringObj(paramsPtr->type, -1)); + } } } else { Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_EMPTY]); Index: tests/parameters.test =================================================================== diff -u -rf671281a240219965d436e2bfa762baf85274ca6 -r0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa --- tests/parameters.test (.../parameters.test) (revision f671281a240219965d436e2bfa762baf85274ca6) +++ tests/parameters.test (.../parameters.test) (revision 0722c5e7a7d98ec23fcb8fdc55f528567c3bd3fa) @@ -2936,6 +2936,30 @@ } # +# Test parameter::get with objects/classes and types +# +nx::test case parameter-get { + nx::Class create C { + :property foo:integer + :property o:object,type=::nx::Object + :property c:class + :property m:metaclass + } + + ? {C info configure parameters foo} "-foo:integer" + ? {nsf::parameter::get type [C info configure parameters foo]} "integer" + + ? {C info configure parameters o} "-o:object,type=::nx::Object" + ? {nsf::parameter::get type [C info configure parameters o]} "object,type=::nx::Object" + + ? {C info configure parameters c} "-c:class" + ? {nsf::parameter::get type [C info configure parameters c]} "class" + + ? {C info configure parameters m} "-m:metaclass" + ? {nsf::parameter::get type [C info configure parameters m]} "metaclass" +} + +# # Local variables: # mode: tcl # tcl-indent-level: 2