summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2007-06-15 22:58:48 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2007-06-15 22:58:48 (GMT)
commit16200300c2d8029b5202c3aacd1263784cbd067a (patch)
treedfc62b38074891ca905e408b8bf941db24453e36 /generic/tclExecute.c
parent0ea1a219a60d3bc60a8ee100c215597ee9d3e9d7 (diff)
downloadtcl-16200300c2d8029b5202c3aacd1263784cbd067a.zip
tcl-16200300c2d8029b5202c3aacd1263784cbd067a.tar.gz
tcl-16200300c2d8029b5202c3aacd1263784cbd067a.tar.bz2
* generic/tclCompCmds.c: Simplified [variable] compiler and
* generic/tclExecute.c: executor. Missed updates to "there is always a valid frame".
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c75
1 files changed, 39 insertions, 36 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 80ec09b..0d6a061 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.294 2007/06/15 19:58:13 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.295 2007/06/15 22:58:49 msofer Exp $
*/
#include "tclInt.h"
@@ -1139,8 +1139,7 @@ TclCompEvalObj(
if (((Interp *) *codePtr->interpHandle != iPtr)
|| (codePtr->compileEpoch != iPtr->compileEpoch)
#ifdef CHECK_PROC_ORIGINATION /* [Bug: 3412 Pedantic] */
- || (codePtr->procPtr != NULL && !(iPtr->varFramePtr &&
- iPtr->varFramePtr->procPtr == codePtr->procPtr))
+ || codePtr->procPtr != iPtr->varFramePtr->procPtr
#endif
|| (codePtr->nsPtr != namespacePtr)
|| (codePtr->nsEpoch != namespacePtr->resolverEpoch)) {
@@ -1430,13 +1429,8 @@ TclExecuteByteCode(
iPtr->stats.numExecutions++;
#endif
- if (iPtr->varFramePtr != NULL) {
- namespacePtr = iPtr->varFramePtr->nsPtr;
- compiledLocals = iPtr->varFramePtr->compiledLocals;
- } else {
- namespacePtr = iPtr->globalNsPtr;
- compiledLocals = NULL;
- }
+ namespacePtr = iPtr->varFramePtr->nsPtr;
+ compiledLocals = iPtr->varFramePtr->compiledLocals;
/*
* Loop executing instructions until a "done" instruction, a TCL_RETURN,
@@ -2900,12 +2894,32 @@ TclExecuteByteCode(
}
case INST_VARIABLE:
+ TRACE("variable ");
+ otherPtr = TclObjLookupVar(interp, OBJ_AT_TOS, NULL,
+ (TCL_NAMESPACE_ONLY | TCL_LEAVE_ERR_MSG), "access",
+ /*createPart1*/ 1, /*createPart2*/ 1, &varPtr);
+ if (otherPtr) {
+ /*
+ * Do the [variable] magic
+ */
+
+ if (!TclIsVarNamespaceVar(otherPtr)) {
+ TclSetVarNamespaceVar(otherPtr);
+ otherPtr->refCount++;
+ }
+ result = TCL_OK;
+ goto doLinkVars;
+ }
+ result = TCL_ERROR;
+ goto checkForCatch;
+
+
case INST_NSUPVAR:
TRACE_WITH_OBJ(("nsupvar "), OBJ_UNDER_TOS);
{
Tcl_Namespace *nsPtr, *savedNsPtr;
-
+
result = TclGetNamespaceFromObj(interp, OBJ_UNDER_TOS, &nsPtr);
if ((result == TCL_OK) && nsPtr) {
/*
@@ -2919,32 +2933,21 @@ TclExecuteByteCode(
/*createPart1*/ 1, /*createPart2*/ 1, &varPtr);
iPtr->varFramePtr->nsPtr = (Namespace *) savedNsPtr;
if (otherPtr) {
- /*
- * Do the [variable] magic if necessary
- */
-
- if ((*pc == INST_VARIABLE)
- && !TclIsVarNamespaceVar(otherPtr)) {
- TclSetVarNamespaceVar(otherPtr);
- otherPtr->refCount++;
- }
- } else {
- result = TCL_ERROR;
- goto checkForCatch;
- }
- } else {
- if (nsPtr == NULL) {
- /*
- * The namespace does not exist, leave an error message.
- */
-
- Tcl_SetObjResult(interp, Tcl_Format(NULL,
- "namespace \"%s\" does not exist", 1,
- &OBJ_UNDER_TOS));
- result = TCL_ERROR;
+ result = TCL_OK;
+ goto doLinkVars;
}
- goto checkForCatch;
}
+ if (!nsPtr) {
+ /*
+ * The namespace does not exist, leave an error message.
+ */
+
+ Tcl_SetObjResult(interp, Tcl_Format(NULL,
+ "namespace \"%s\" does not exist", 1,
+ &OBJ_UNDER_TOS));
+ }
+ result = TCL_ERROR;
+ goto checkForCatch;
}
doLinkVars:
@@ -2983,7 +2986,7 @@ TclExecuteByteCode(
/*
* Do not pop the namespace or frame index, it may be needed for other
- * variables.
+ * variables - and [variable] did not push it at all.
*/
doLinkVarsDone: