summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2004-12-12 23:16:18 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2004-12-12 23:16:18 (GMT)
commit16f317ea1543e3ccc59306c6ecb398b165d30bc6 (patch)
tree50c63fd8373301759324b3ce322802b9b780f057
parentbc7e98d373bca23af3b39ab27dcd19e516701091 (diff)
downloadtcl-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]).
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclObj.c20
2 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 84aaa0e..57a7eef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-12 Miguel Sofer <msofer@users.sf.net>
+
+ * generic/tclObj.c (TclSetCmdNameObj): special handling for fully
+ qualified command names (as in fix [Patch 456668]).
+
2004-12-11 Miguel Sofer <msofer@users.sf.net>
* generic/tclInt.h:
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;
}
/*