summaryrefslogtreecommitdiffstats
path: root/generic/tclOOBasic.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-05-13 19:20:52 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-05-13 19:20:52 (GMT)
commit9be0bdc722bef9130221d58cb3f9c1c47defe731 (patch)
treef3ca471401c17e7a36b327041660b7ab1031e571 /generic/tclOOBasic.c
parente95ec66527c52fe63922e8d6966d230c3b92c72b (diff)
downloadtcl-9be0bdc722bef9130221d58cb3f9c1c47defe731.zip
tcl-9be0bdc722bef9130221d58cb3f9c1c47defe731.tar.gz
tcl-9be0bdc722bef9130221d58cb3f9c1c47defe731.tar.bz2
Correct results from unknown method handler.
Diffstat (limited to 'generic/tclOOBasic.c')
-rw-r--r--generic/tclOOBasic.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 6306416..763f0ad 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -500,9 +500,12 @@ TclOO_Object_Unknown(
Tcl_Obj *const *objv) /* The actual arguments. */
{
CallContext *contextPtr = (CallContext *) context;
+ Object *callerObj = NULL;
+ Class *callerCls = NULL;
Object *oPtr = contextPtr->oPtr;
const char **methodNames;
int numMethodNames, i, skip = Tcl_ObjectContextSkippedArgs(context);
+ CallFrame *framePtr = ((Interp *) interp)->varFramePtr;
Tcl_Obj *errorMsg;
/*
@@ -517,10 +520,31 @@ TclOO_Object_Unknown(
}
/*
+ * Determine if the calling context should know about extra private
+ * methods, and if so, which.
+ */
+
+ if (framePtr->isProcCallFrame & FRAME_IS_METHOD) {
+ CallContext *callerContext = framePtr->clientData;
+ Method *mPtr = callerContext->callPtr->chain[
+ callerContext->index].mPtr;
+
+ if (mPtr->declaringObjectPtr) {
+ if (oPtr == mPtr->declaringObjectPtr) {
+ callerObj = mPtr->declaringObjectPtr;
+ }
+ } else {
+ if (TclOOIsReachable(mPtr->declaringClassPtr, oPtr->selfCls)) {
+ callerCls = mPtr->declaringClassPtr;
+ }
+ }
+ }
+
+ /*
* Get the list of methods that we want to know about.
*/
- numMethodNames = TclOOGetSortedMethodList(oPtr,
+ numMethodNames = TclOOGetSortedMethodList(oPtr, callerObj, callerCls,
contextPtr->callPtr->flags & PUBLIC_METHOD, &methodNames);
/*