summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-01 09:31:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-01 09:31:37 (GMT)
commitb89c01475a4aa977cfa56b2292504c60de9a7427 (patch)
tree4a2fd384cf9bd128a79d1713e710adeb4174a647 /generic/tclExecute.c
parent8f2b15e6db98e069f1a7296f7c96da79b5515aad (diff)
parentb924d89e299f95beaf3c6bd1ae4adf16aa3c38d4 (diff)
downloadtcl-b89c01475a4aa977cfa56b2292504c60de9a7427.zip
tcl-b89c01475a4aa977cfa56b2292504c60de9a7427.tar.gz
tcl-b89c01475a4aa977cfa56b2292504c60de9a7427.tar.bz2
Merge 8.7
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 520c2ee..faf5865 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -1981,7 +1981,14 @@ TclNRExecuteByteCode(
*/
TclNRAddCallback(interp, TEBCresume, TD, /* pc */ NULL,
- /* cleanup */ INT2PTR(0), NULL);
+ /* cleanup */ INT2PTR(0), INT2PTR(iPtr->evalFlags));
+
+ /*
+ * Reset discard result flag - because it is applicable for this call only,
+ * and should not affect all the nested invocations may return result.
+ */
+ iPtr->evalFlags &= ~TCL_EVAL_DISCARD_RESULT;
+
return TCL_OK;
}
@@ -2043,6 +2050,7 @@ TEBCresume(
#define auxObjList (TD->auxObjList)
#define catchTop (TD->catchTop)
#define codePtr (TD->codePtr)
+#define curEvalFlags PTR2INT(data[3]) /* calling iPtr->evalFlags */
/*
* Globals: variables that store state, must remain valid at all times.
@@ -2526,6 +2534,14 @@ TEBCresume(
case INST_DONE:
if (tosPtr > initTosPtr) {
+
+ if ((curEvalFlags & TCL_EVAL_DISCARD_RESULT) && (result == TCL_OK)) {
+ /* simulate pop & fast done (like it does continue in loop) */
+ TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS);
+ objPtr = POP_OBJECT();
+ TclDecrRefCount(objPtr);
+ goto abnormalReturn;
+ }
/*
* Set the interpreter's object result to point to the topmost
* object from the stack, and check for a possible [catch]. The
@@ -7695,7 +7711,7 @@ TEBCresume(
*/
/*
- * Abnormal return code. Restore the stack to state it had when
+ * Done or abnormal return code. Restore the stack to state it had when
* starting to execute the ByteCode. Panic if the stack is below the
* initial level.
*/