diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2004-12-12 23:16:18 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2004-12-12 23:16:18 (GMT) |
commit | 16f317ea1543e3ccc59306c6ecb398b165d30bc6 (patch) | |
tree | 50c63fd8373301759324b3ce322802b9b780f057 /generic/tclObj.c | |
parent | bc7e98d373bca23af3b39ab27dcd19e516701091 (diff) | |
download | tcl-16f317ea1543e3ccc59306c6ecb398b165d30bc6.zip tcl-16f317ea1543e3ccc59306c6ecb398b165d30bc6.tar.gz tcl-16f317ea1543e3ccc59306c6ecb398b165d30bc6.tar.bz2 |
* generic/tclObj.c (TclSetCmdNameObj): special handling for fully qualified
command names (as in fix [Patch 456668]).
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index d7dd7b1..a847e0f 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.72 2004/10/06 15:59:25 dgp Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.73 2004/12/12 23:16:23 msofer Exp $ */ #include "tclInt.h" @@ -3265,12 +3265,28 @@ TclSetCmdNameObj(interp, objPtr, cmdPtr) Interp *iPtr = (Interp *) interp; register ResolvedCmdName *resPtr; register Namespace *currNsPtr; + CallFrame *savedFramePtr; + char *name; if (objPtr->typePtr == &tclCmdNameType) { return; } /* + * If the variable name is fully qualified, do as if the lookup were + * done from the global namespace; this helps avoid repeated lookups + * of fully qualified names. It costs close to nothing, and may be very + * helpful for OO applications which pass along a command name ("this"), + * [Patch 456668] (Copied over from Tcl_GetCommandFromObj) + */ + + savedFramePtr = iPtr->varFramePtr; + name = Tcl_GetString(objPtr); + if ((*name++ == ':') && (*name == ':')) { + iPtr->varFramePtr = NULL; + } + + /* * Get the current namespace. */ @@ -3293,6 +3309,8 @@ TclSetCmdNameObj(interp, objPtr, cmdPtr) objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclCmdNameType; + + iPtr->varFramePtr = savedFramePtr; } /* |