diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2017-06-18 13:44:39 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2017-06-18 13:44:39 (GMT) |
commit | 1b7b8dde9532a298958b3cd47f765be2543503cb (patch) | |
tree | b26bdee87f80513f512d63c489b3a507f945275d | |
parent | 4e10527bc253b20ce87e44a635f090d99827c7d9 (diff) | |
download | tcl-1b7b8dde9532a298958b3cd47f765be2543503cb.zip tcl-1b7b8dde9532a298958b3cd47f765be2543503cb.tar.gz tcl-1b7b8dde9532a298958b3cd47f765be2543503cb.tar.bz2 |
Also apply the tricks when going via the 'self' definition.
-rw-r--r-- | generic/tclOODefineCmds.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index cea54b5..09a06b1 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1045,6 +1045,7 @@ TclOODefineSelfObjCmd( Foundation *fPtr = TclOOGetFoundation(interp); int result; Object *oPtr; + Tcl_Namespace *nsPtr = NULL; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); @@ -1061,7 +1062,15 @@ TclOODefineSelfObjCmd( * command(s). */ - if (InitDefineContext(interp, fPtr->objdefNs, oPtr, objc,objv) != TCL_OK){ + if (oPtr->definitionNs && + TclGetNamespaceFromObj(interp, oPtr->definitionNs, + &nsPtr) != TCL_OK) { + return TCL_ERROR; + } + if (nsPtr == NULL) { + nsPtr = fPtr->objdefNs; + } + if (InitDefineContext(interp, nsPtr, oPtr, objc, objv) != TCL_OK) { return TCL_ERROR; } @@ -1100,7 +1109,7 @@ TclOODefineSelfObjCmd( objPtr = Tcl_NewObj(); obj2Ptr = Tcl_NewObj(); - cmd = FindCommand(interp, objv[1], fPtr->objdefNs); + cmd = FindCommand(interp, objv[1], nsPr); if (cmd == NULL) { /* punt this case! */ Tcl_AppendObjToObj(obj2Ptr, objv[1]); |