Index: TODO =================================================================== diff -u -rece9e8e60ebe51b69dcb0511110a030d7c71f59f -ra58654d068b1dbd5395f9d26884a70a95363c892 --- TODO (.../TODO) (revision ece9e8e60ebe51b69dcb0511110a030d7c71f59f) +++ TODO (.../TODO) (revision a58654d068b1dbd5395f9d26884a70a95363c892) @@ -4833,6 +4833,10 @@ nx-mongo: - implement simple persistent handle management based on per-thread objects +-nsf.c: +- fix bug in interaction between uplevel method and interceptor transparency +- extend regression test + ======================================================================== TODO: Index: generic/nsfStack.c =================================================================== diff -u -r880487204ff2da18d2d25ebd727b9b4bbda86c8e -ra58654d068b1dbd5395f9d26884a70a95363c892 --- generic/nsfStack.c (.../nsfStack.c) (revision 880487204ff2da18d2d25ebd727b9b4bbda86c8e) +++ generic/nsfStack.c (.../nsfStack.c) (revision a58654d068b1dbd5395f9d26884a70a95363c892) @@ -412,21 +412,22 @@ NsfCallStackFindLastInvocation(Tcl_Interp *interp, int offset, Tcl_CallFrame **framePtrPtr) { register Tcl_CallFrame *varFramePtr = (Tcl_CallFrame *)Tcl_Interp_varFramePtr(interp); int lvl = Tcl_CallFrame_level(varFramePtr); + + for (; likely(varFramePtr != NULL); varFramePtr = Tcl_CallFrame_callerVarPtr(varFramePtr)) { - for (; varFramePtr; varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr)) { if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { NsfCallStackContent *cscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); + if ((cscPtr->flags & (NSF_CSC_CALL_IS_NEXT|NSF_CSC_CALL_IS_ENSEMBLE)) || (cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) { continue; } + if (offset) { offset--; - } else { - if (Tcl_CallFrame_level(varFramePtr) < lvl) { - if (framePtrPtr) *framePtrPtr = varFramePtr; - return cscPtr; - } + } else if (Tcl_CallFrame_level(varFramePtr) < lvl) { + if (framePtrPtr) *framePtrPtr = varFramePtr; + return cscPtr; } } } Index: tests/methods.test =================================================================== diff -u -r4b9ddd1b06ce34fd352791fcae53ad91a79b43ce -ra58654d068b1dbd5395f9d26884a70a95363c892 --- tests/methods.test (.../methods.test) (revision 4b9ddd1b06ce34fd352791fcae53ad91a79b43ce) +++ tests/methods.test (.../methods.test) (revision a58654d068b1dbd5395f9d26884a70a95363c892) @@ -1116,3 +1116,41 @@ ? {string match "invalid non-positional*" $errMsg} 1 } + + +nx::test case uplevel+mixin-transparency { + + nx::Object create ns_cache { + :public object method eval {script} { + set rc [catch {:uplevel $script} result] + return -code $rc $result + } + } + nx::Class create DBI { + :public method 1row {} { :uplevel {return $x} } + } + nx::Class create Profile { + :public method 1row {} { next } + } + DBI create db + + nx::Class create C { + :public method foo {} { + set x 1 + return [db 1row] + } + :public method bar {} { + set x 2 + return [ns_cache eval {db 1row}] + } + :create c1 + } + + ? {c1 foo} 1 + ? {c1 bar} 2 + + db object mixin Profile + ? {c1 foo} 1 + ? {c1 bar} 2 + +}