summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2016-05-25 17:27:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2016-05-25 17:27:49 (GMT)
commitec75618b67ba6350be88fd617aac6122cecc5250 (patch)
treef6f6adfd05ac35227af0cbee292a655df45cdddb /generic/tclProc.c
parent13a6722593334f23786c8c20f446a8027a8ebe6c (diff)
downloadtcl-ec75618b67ba6350be88fd617aac6122cecc5250.zip
tcl-ec75618b67ba6350be88fd617aac6122cecc5250.tar.gz
tcl-ec75618b67ba6350be88fd617aac6122cecc5250.tar.bz2
Refactor all iPtr->ensembleRewrite setting code into TclInitRewriteEnsemble()
calls. This likely fixes many weird corner case bugs, and definitly makes future development and maintenance easier.
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 1a3bdb7..56d29a2 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -22,7 +22,6 @@
*/
typedef struct {
- int isRootEnsemble;
Command cmd;
ExtraFrameInfo efi;
} ApplyExtraData;
@@ -2636,7 +2635,7 @@ TclNRApplyObjCmd(
Interp *iPtr = (Interp *) interp;
Proc *procPtr = NULL;
Tcl_Obj *lambdaPtr, *nsObjPtr;
- int result, isRootEnsemble;
+ int result;
Tcl_Namespace *nsPtr;
ApplyExtraData *extraPtr;
@@ -2719,15 +2718,9 @@ TclNRApplyObjCmd(
extraPtr->efi.fields[0].clientData = lambdaPtr;
extraPtr->cmd.clientData = &extraPtr->efi;
- isRootEnsemble = (iPtr->ensembleRewrite.sourceObjs == NULL);
- if (isRootEnsemble) {
- iPtr->ensembleRewrite.sourceObjs = objv;
- iPtr->ensembleRewrite.numRemovedObjs = 1;
- iPtr->ensembleRewrite.numInsertedObjs = 0;
- } else {
- iPtr->ensembleRewrite.numInsertedObjs -= 1;
+ if (TclInitRewriteEnsemble(interp, 1, 0, objv)) {
+ TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL, NULL);
}
- extraPtr->isRootEnsemble = isRootEnsemble;
result = TclPushProcCallFrame(procPtr, interp, objc, objv, 1);
if (result == TCL_OK) {
@@ -2745,10 +2738,6 @@ ApplyNR2(
{
ApplyExtraData *extraPtr = data[0];
- if (extraPtr->isRootEnsemble) {
- ((Interp *) interp)->ensembleRewrite.sourceObjs = NULL;
- }
-
TclStackFree(interp, extraPtr);
return result;
}