From 348e41c66d05f58ef37fb1307b90d49a09b112db Mon Sep 17 00:00:00 2001 From: dgp Date: Sun, 9 Sep 2007 14:34:06 +0000 Subject: * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate routine to compile ** to account for its different associativity. --- ChangeLog | 5 +++++ generic/tclCompCmds.c | 23 ++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c1df79..8eda2b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-09 Don Porter + + * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate + routine to compile ** to account for its different associativity. + 2007-09-08 Miguel Sofer * generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710] diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c index 1991ffb..6e1a683 100644 --- a/generic/tclCompCmds.c +++ b/generic/tclCompCmds.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompCmds.c,v 1.116 2007/08/27 19:56:51 dgp Exp $ + * RCS: @(#) $Id: tclCompCmds.c,v 1.117 2007/09/09 14:34:08 dgp Exp $ */ #include "tclInt.h" @@ -5042,13 +5042,22 @@ TclCompilePowOpCmd( Tcl_Parse *parsePtr, CompileEnv *envPtr) { - /* - * The ** operator isn't associative, but the right to left calculation - * order of the called routine is correct. - */ + Tcl_Token *tokenPtr = parsePtr->tokenPtr; + DefineLineInformation; /* TIP #280 */ + int words; - return CompileAssociativeBinaryOpCmd(interp, parsePtr, "1", INST_EXPON, - envPtr); + for (words=1 ; wordsnumWords ; words++) { + tokenPtr = TokenAfter(tokenPtr); + CompileWord(envPtr, tokenPtr, interp, words); + } + if (parsePtr->numWords <= 2) { + PushLiteral(envPtr, "1", 1); + words++; + } + while (--words > 1) { + TclEmitOpcode(INST_EXPON, envPtr); + } + return TCL_OK; } int -- cgit v0.12