diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-14 07:24:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-08-14 07:24:45 (GMT) |
commit | 6e2f02a5a6a694d1c1ad853307791acf1fd85c92 (patch) | |
tree | 7d98f24bc0e1f58d9bf18be980e4d1cbc157947e /generic/tclExecute.c | |
parent | 20bd9d9cabc9db212abbaf9d4dbb18eb490e9f71 (diff) | |
parent | c9376306301e578615cfee52d2121f78cb31a225 (diff) | |
download | tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.zip tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.tar.gz tcl-6e2f02a5a6a694d1c1ad853307791acf1fd85c92.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 871a463..4b25064 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. */ |