diff options
author | dgp <dgp@users.sourceforge.net> | 2016-07-01 13:36:23 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-07-01 13:36:23 (GMT) |
commit | fb15425b36070fb5fe42807956a679f5ecbf096b (patch) | |
tree | be7c6f8e18f99b8f12153eee12b43ce2a4b1e2a5 | |
parent | 64dfc63889ae62e8b5214a4bd1baf30f386c434e (diff) | |
parent | 8c8ec10e78e872ffa4e4edef6ae16e03d5872efc (diff) | |
download | tcl-fb15425b36070fb5fe42807956a679f5ecbf096b.zip tcl-fb15425b36070fb5fe42807956a679f5ecbf096b.tar.gz tcl-fb15425b36070fb5fe42807956a679f5ecbf096b.tar.bz2 |
merge trunk; eliminate legacy hacks for Itcl 3; migration paths in place.
-rw-r--r-- | generic/tclIndexObj.c | 33 | ||||
-rw-r--r-- | generic/tclProc.c | 14 | ||||
-rw-r--r-- | tests/indexObj.test | 5 |
3 files changed, 6 insertions, 46 deletions
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index b80d649..c183361 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -820,29 +820,6 @@ Tcl_WrongNumArgs( Interp *iPtr = (Interp *) interp; const char *elementStr; - /* - * [incr Tcl] does something fairly horrific when generating error - * messages for its ensembles; it passes the whole set of ensemble - * arguments as a list in the first argument. This means that this code - * causes a problem in iTcl if it attempts to correctly quote all - * arguments, which would be the correct thing to do. We work around this - * nasty behaviour for now, and hope that we can remove it all in the - * future... - */ - -#ifndef AVOID_HACKS_FOR_ITCL - int isFirst = 1; /* Special flag used to inhibit the treating - * of the first word as a list element so the - * hacky way Itcl generates error messages for - * its ensembles will still work. [Bug - * 1066837] */ -# define MAY_QUOTE_WORD (!isFirst) -# define AFTER_FIRST_WORD (isFirst = 0) -#else /* !AVOID_HACKS_FOR_ITCL */ -# define MAY_QUOTE_WORD 1 -# define AFTER_FIRST_WORD (void) 0 -#endif /* AVOID_HACKS_FOR_ITCL */ - TclNewObj(objPtr); if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) { iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS; @@ -907,7 +884,7 @@ Tcl_WrongNumArgs( flags = 0; len = TclScanElement(elementStr, elemLen, &flags); - if (MAY_QUOTE_WORD && len != elemLen) { + if (len != elemLen) { char *quotedElementStr = TclStackAlloc(interp, (unsigned)len + 1); @@ -919,8 +896,6 @@ Tcl_WrongNumArgs( Tcl_AppendToObj(objPtr, elementStr, elemLen); } - AFTER_FIRST_WORD; - /* * Add a space if the word is not the last one (which has a * moderately complex condition here). @@ -963,7 +938,7 @@ Tcl_WrongNumArgs( flags = 0; len = TclScanElement(elementStr, elemLen, &flags); - if (MAY_QUOTE_WORD && len != elemLen) { + if (len != elemLen) { char *quotedElementStr = TclStackAlloc(interp, (unsigned) len + 1); @@ -976,8 +951,6 @@ Tcl_WrongNumArgs( } } - AFTER_FIRST_WORD; - /* * Append a space character (" ") if there is more text to follow * (either another element from objv, or the message string). @@ -1000,8 +973,6 @@ Tcl_WrongNumArgs( Tcl_AppendStringsToObj(objPtr, "\"", NULL); Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL); Tcl_SetObjResult(interp, objPtr); -#undef MAY_QUOTE_WORD -#undef AFTER_FIRST_WORD } /* diff --git a/generic/tclProc.c b/generic/tclProc.c index b663caf..9c4fd1d 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -1087,13 +1087,7 @@ ProcWrongNumArgs( if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) { desiredObjs[0] = Tcl_NewStringObj("lambdaExpr", -1); } else { - ((Interp *) interp)->ensembleRewrite.numInsertedObjs -= skip - 1; - -#ifdef AVOID_HACKS_FOR_ITCL desiredObjs[0] = framePtr->objv[skip-1]; -#else - desiredObjs[0] = Tcl_NewListObj(skip, framePtr->objv); -#endif /* AVOID_HACKS_FOR_ITCL */ } Tcl_IncrRefCount(desiredObjs[0]); @@ -1527,6 +1521,10 @@ InitArgsAndLocals( */ incorrectArgs: + if ((skip != 1) && + TclInitRewriteEnsemble(interp, skip-1, 0, framePtr->objv)) { + TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL, NULL); + } memset(varPtr, 0, ((framePtr->compiledLocals + localCt)-varPtr) * sizeof(Var)); return ProcWrongNumArgs(interp, skip); @@ -2716,10 +2714,6 @@ TclNRApplyObjCmd( extraPtr->efi.fields[0].clientData = lambdaPtr; extraPtr->cmd.clientData = &extraPtr->efi; - if (TclInitRewriteEnsemble(interp, 1, 0, objv)) { - TclNRAddCallback(interp, TclClearRootEnsemble, NULL, NULL, NULL, NULL); - } - result = TclPushProcCallFrame(procPtr, interp, objc, objv, 1); if (result == TCL_OK) { TclNRAddCallback(interp, ApplyNR2, extraPtr, NULL, NULL, NULL); diff --git a/tests/indexObj.test b/tests/indexObj.test index 646cb02..f4d3dc6 100644 --- a/tests/indexObj.test +++ b/tests/indexObj.test @@ -107,11 +107,6 @@ test indexObj-5.5 {Tcl_WrongNumArgs} testindexobj { test indexObj-5.6 {Tcl_WrongNumArgs} testindexobj { testwrongnumargs 2 "" mycmd foo } "wrong # args: should be \"mycmd foo\"" -# Contrast this with test proc-3.6; they have to be like this because -# of [Bug 1066837] so Itcl won't break. -test indexObj-5.7 {Tcl_WrongNumArgs} testindexobj { - testwrongnumargs 2 "fee fi" "fo fum" foo bar -} "wrong # args: should be \"fo fum foo fee fi\"" test indexObj-6.1 {Tcl_GetIndexFromObjStruct} testindexobj { set x a |