Index: generic/nsf.c =================================================================== diff -u -r2a2f104357f92c52f53b72025ae2183152644140 -rd01fb5ad47bb23f2069f048e4344c70485bdd9b9 --- generic/nsf.c (.../nsf.c) (revision 2a2f104357f92c52f53b72025ae2183152644140) +++ generic/nsf.c (.../nsf.c) (revision d01fb5ad47bb23f2069f048e4344c70485bdd9b9) @@ -18637,8 +18637,8 @@ NsfProcStubDeleteProc(ClientData clientData) { NsfProcClientData *tcd = clientData; - fprintf(stderr, "NsfProcStubDeleteProc received %p\n", clientData); - /*fprintf(stderr, "... procName %s paramDefs %p\n", ObjStr(tcd->procName), tcd->paramDefs);*/ + /* fprintf(stderr, "NsfProcStubDeleteProc received %p\n", clientData); + fprintf(stderr, "... procName %s paramDefs %p\n", ObjStr(tcd->procName), tcd->paramDefs);*/ DECR_REF_COUNT2("procNameObj", tcd->procName); if (tcd->cmd != NULL) { @@ -18693,7 +18693,7 @@ fullMethodName = ObjStr(procNameObj); CheckCStack(interp, "nsfProc", fullMethodName); - /*fprintf(stderr, "=== InvokeShadowedProc %s objc %d\n", fullMethodName, objc);*/ + /* fprintf(stderr, "=== InvokeShadowedProc %s objc %d\n", fullMethodName, objc); */ /* * The code below is derived from the scripted method dispatch and just @@ -18738,8 +18738,8 @@ } #if defined(NRE) - /*fprintf(stderr, "CALL TclNRInterpProcCore proc '%s' %s nameObj %p %s\n", - ObjStr(objv[0]), fullMethodName, procNameObj, ObjStr(procNameObj));*/ + /* fprintf(stderr, "CALL TclNRInterpProcCore proc '%s' %s nameObj %p %s\n", + ObjStr(objv[0]), fullMethodName, procNameObj, ObjStr(procNameObj)); */ Tcl_NRAddCallback(interp, ProcDispatchFinalize, (ClientData)fullMethodName, pcPtr, @@ -18864,13 +18864,19 @@ Tcl_Command newCmdPtr = Tcl_GetCommandFromObj(interp, tcd->procName); if (unlikely(newCmdPtr == NULL)) { - return NsfPrintError(interp, "cannot lookup command '%s'", - ObjStr(tcd->procName)); + result = NsfPrintError(interp, "cannot lookup command '%s'", + ObjStr(tcd->procName)); + ParseContextRelease(pcPtr); + NsfTclStackFree(interp, pcPtr, "release parse context"); + return result; } if (unlikely(!CmdIsProc(newCmdPtr))) { - return NsfPrintError(interp, "command '%s' is not a proc", - ObjStr(tcd->procName)); + result = NsfPrintError(interp, "command '%s' is not a proc", + ObjStr(tcd->procName)); + ParseContextRelease(pcPtr); + NsfTclStackFree(interp, pcPtr, "release parse context"); + return result; } /* Index: tests/nsf-cmd.test =================================================================== diff -u -r2a2f104357f92c52f53b72025ae2183152644140 -rd01fb5ad47bb23f2069f048e4344c70485bdd9b9 --- tests/nsf-cmd.test (.../nsf-cmd.test) (revision 2a2f104357f92c52f53b72025ae2183152644140) +++ tests/nsf-cmd.test (.../nsf-cmd.test) (revision d01fb5ad47bb23f2069f048e4344c70485bdd9b9) @@ -617,7 +617,7 @@ namespace delete ::ns1 } -nx::test case nsf-proc-rename-delete { +nx::test case nsf-proc-backstage-rename { namespace eval ::ns1 {} ? {info commands ::ns1::foo} "" ? {info commands ::nsf::procs::ns1::foo} "" @@ -636,22 +636,72 @@ ? {::ns1::foo -x ok} "1-ok" - rename [set x ::nsf::procs::ns1::foo] "" + rename ::nsf::procs::ns1::foo "" ? {info commands ::ns1::foo} "::ns1::foo" ? {info commands ::nsf::procs::ns1::foo} "" ? {info procs ::ns1::foo} "" ? {info procs ::nsf::procs::ns1::foo} "" - ? {::ns1::foo -x ok} {invalid command name "::ns1::foo"} + ? {::ns1::foo -x ok} {cannot lookup command '::nsf::procs::ns1::foo'} + rename ::ns1::foo "" + + ? {info commands ::ns1::foo} "" + ? {info commands ::nsf::procs::ns1::foo} "" + ? {info procs ::ns1::foo} "" + ? {info procs ::nsf::procs::ns1::foo} "" + + ? {::ns1::foo -x ok} {invalid command name "::ns1::foo"} + namespace eval ::ns1 {} } +nx::test case nsf-proc-backstage-rename-2 { + namespace eval ::ns1 {} + ? {info commands ::ns1::foo} "" + ? {info commands ::nsf::procs::ns1::foo} "" + ? {info procs ::ns1::foo} "" + ? {info procs ::nsf::procs::ns1::foo} "" -# - to-do interp hide/expose + ? {::ns1::foo -x ok} {invalid command name "::ns1::foo"} + + nsf::proc ::ns1::foo { + {-x:required} + } { return 1-$x } + ? {info commands ::ns1::foo} "::ns1::foo" + ? {info commands ::nsf::procs::ns1::foo} "::nsf::procs::ns1::foo" + ? {info procs ::ns1::foo} "" + ? {info procs ::nsf::procs::ns1::foo} "::nsf::procs::ns1::foo" + ? {::ns1::foo -x ok} "1-ok" + rename ::nsf::procs::ns1::foo "" + nx::Object create ::nsf::procs::ns1::foo + + ? {info commands ::ns1::foo} "::ns1::foo" + ? {info commands ::nsf::procs::ns1::foo} "::nsf::procs::ns1::foo" + ? {info procs ::ns1::foo} "" + ? {info procs ::nsf::procs::ns1::foo} "" + + ? {::ns1::foo -x ok} {command '::nsf::procs::ns1::foo' is not a proc} + + rename ::ns1::foo "" + + ? {info commands ::ns1::foo} "" + ? {info commands ::nsf::procs::ns1::foo} "::nsf::procs::ns1::foo" + ? {info procs ::ns1::foo} "" + ? {info procs ::nsf::procs::ns1::foo} "" + + ? {::ns1::foo -x ok} {invalid command name "::ns1::foo"} + + namespace eval ::ns1 {} + rename ::nsf::procs::ns1::foo "" +} + +# - TO-DO: interp hide/expose + + # # Local variables: # mode: tcl