diff options
author | dgp <dgp@users.sourceforge.net> | 2004-10-15 21:02:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-10-15 21:02:30 (GMT) |
commit | 7118dbc976774fdef3cc20ad168c22f23ed582f0 (patch) | |
tree | f7b7bc5b3c31a0c3f348987c7b5b21feac0477c3 /generic/tclCmdMZ.c | |
parent | 0821784e04e2aa7a2582947073659cde9e421abd (diff) | |
download | tcl-7118dbc976774fdef3cc20ad168c22f23ed582f0.zip tcl-7118dbc976774fdef3cc20ad168c22f23ed582f0.tar.gz tcl-7118dbc976774fdef3cc20ad168c22f23ed582f0.tar.bz2 |
* generic/tclCmdMZ.c (TclProcessReturn): Now that primary
* generic/tclProc.c (TclUpdateReturnInfo): storage for the
errorInfo and errorCode values are internal fields, we can set
them at the time of the [return] command, and not have to wait
until the specified number of "-level"s have popped.
Diffstat (limited to 'generic/tclCmdMZ.c')
-rw-r--r-- | generic/tclCmdMZ.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index a408db6..3fba9fc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.112 2004/10/15 04:01:28 dgp Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.113 2004/10/15 21:02:35 dgp Exp $ */ #include "tclInt.h" @@ -901,37 +901,36 @@ TclProcessReturn(interp, code, level, returnOpts) Tcl_IncrRefCount(iPtr->returnOpts); } - if (level == 0) { - if (code == TCL_ERROR) { - valuePtr = NULL; - Tcl_DictObjGet(NULL, iPtr->returnOpts, - iPtr->returnErrorinfoKey, &valuePtr); - if (valuePtr != NULL) { - int infoLen; - CONST char *info = Tcl_GetStringFromObj(valuePtr, &infoLen); - if (infoLen) { - Tcl_AddObjErrorInfo(interp, info, infoLen); - iPtr->flags |= ERR_ALREADY_LOGGED; - } - } - valuePtr = NULL; - Tcl_DictObjGet(NULL, iPtr->returnOpts, - iPtr->returnErrorcodeKey, &valuePtr); - if (valuePtr != NULL) { - Tcl_SetObjErrorCode(interp, valuePtr); - } else { - Tcl_SetErrorCode(interp, "NONE", NULL); - } + if (code == TCL_ERROR) { + valuePtr = NULL; + Tcl_DictObjGet(NULL, iPtr->returnOpts, + iPtr->returnErrorinfoKey, &valuePtr); + if (valuePtr != NULL) { + int infoLen; + CONST char *info = Tcl_GetStringFromObj(valuePtr, &infoLen); + if (infoLen) { + Tcl_AddObjErrorInfo(interp, info, infoLen); + iPtr->flags |= ERR_ALREADY_LOGGED; + } + } + valuePtr = NULL; + Tcl_DictObjGet(NULL, iPtr->returnOpts, + iPtr->returnErrorcodeKey, &valuePtr); + if (valuePtr != NULL) { + Tcl_SetObjErrorCode(interp, valuePtr); + } else { + Tcl_SetErrorCode(interp, "NONE", NULL); + } - valuePtr = NULL; - Tcl_DictObjGet(NULL, iPtr->returnOpts, - iPtr->returnErrorlineKey, &valuePtr); - if (valuePtr != NULL) { - Tcl_GetIntFromObj(NULL, valuePtr, &iPtr->errorLine); - } + valuePtr = NULL; + Tcl_DictObjGet(NULL, iPtr->returnOpts, + iPtr->returnErrorlineKey, &valuePtr); + if (valuePtr != NULL) { + Tcl_GetIntFromObj(NULL, valuePtr, &iPtr->errorLine); } - } else { - code = TCL_RETURN; + } + if (level != 0) { + return TCL_RETURN; } return code; } |