summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-09-09 14:34:06 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-09-09 14:34:06 (GMT)
commit348e41c66d05f58ef37fb1307b90d49a09b112db (patch)
tree6a0576f551f819707f1cc139472019ff6d8096ec
parent14632a9fcf8e523ae2abf3c2b5c661721835998d (diff)
downloadtcl-348e41c66d05f58ef37fb1307b90d49a09b112db.zip
tcl-348e41c66d05f58ef37fb1307b90d49a09b112db.tar.gz
tcl-348e41c66d05f58ef37fb1307b90d49a09b112db.tar.bz2
* generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate
routine to compile ** to account for its different associativity.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclCompCmds.c23
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 <dgp@users.sourceforge.net>
+
+ * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate
+ routine to compile ** to account for its different associativity.
+
2007-09-08 Miguel Sofer <msofer@users.sf.net>
* 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 ; words<parsePtr->numWords ; 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