summaryrefslogtreecommitdiffstats
path: root/generic/tclOODefineCmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclOODefineCmds.c')
-rw-r--r--generic/tclOODefineCmds.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 64209a0..8747ff5 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -848,7 +848,7 @@ TclOODefineObjCmd(
} else {
Tcl_Obj *objPtr, *obj2Ptr, **objs;
Tcl_Command cmd;
- int dummy;
+ int isRoot, dummy;
/*
* More than one argument: fire them through the ensemble processing
@@ -860,7 +860,7 @@ TclOODefineObjCmd(
* the moment. Ugly!
*/
- TclInitRewriteEnsemble(interp, 3, 1, objv);
+ isRoot = TclInitRewriteEnsemble(interp, 3, 1, objv);
/*
* Build the list of arguments using a Tcl_Obj as a workspace. See
@@ -882,6 +882,9 @@ TclOODefineObjCmd(
Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs);
result = Tcl_EvalObjv(interp, objc-2, objs, TCL_EVAL_INVOKE);
+ if (isRoot) {
+ TclResetRewriteEnsemble(interp, 1);
+ }
Tcl_DecrRefCount(objPtr);
}
DelRef(oPtr);
@@ -915,7 +918,7 @@ TclOOObjDefObjCmd(
Tcl_Obj *const *objv)
{
Foundation *fPtr = TclOOGetFoundation(interp);
- int result;
+ int isRoot, result;
Object *oPtr;
if (objc < 3) {
@@ -963,7 +966,7 @@ TclOOObjDefObjCmd(
* the moment. Ugly!
*/
- TclInitRewriteEnsemble(interp, 3, 1, objv);
+ isRoot = TclInitRewriteEnsemble(interp, 3, 1, objv);
/*
* Build the list of arguments using a Tcl_Obj as a workspace. See
@@ -985,6 +988,10 @@ TclOOObjDefObjCmd(
Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs);
result = Tcl_EvalObjv(interp, objc-2, objs, TCL_EVAL_INVOKE);
+
+ if (isRoot) {
+ TclResetRewriteEnsemble(interp, 1);
+ }
Tcl_DecrRefCount(objPtr);
}
DelRef(oPtr);
@@ -1054,7 +1061,7 @@ TclOODefineSelfObjCmd(
} else {
Tcl_Obj *objPtr, *obj2Ptr, **objs;
Tcl_Command cmd;
- int dummy;
+ int isRoot, dummy;
/*
* More than one argument: fire them through the ensemble processing
@@ -1066,7 +1073,7 @@ TclOODefineSelfObjCmd(
* the moment. Ugly!
*/
- TclInitRewriteEnsemble(interp, 2, 1, objv);
+ isRoot = TclInitRewriteEnsemble(interp, 2, 1, objv);
/*
* Build the list of arguments using a Tcl_Obj as a workspace. See
@@ -1088,6 +1095,9 @@ TclOODefineSelfObjCmd(
Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs);
result = Tcl_EvalObjv(interp, objc-1, objs, TCL_EVAL_INVOKE);
+ if (isRoot) {
+ TclResetRewriteEnsemble(interp, 1);
+ }
Tcl_DecrRefCount(objPtr);
}
DelRef(oPtr);