summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-03-07 19:15:57 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-03-07 19:15:57 (GMT)
commit1d90d3f1d30da3d67a75b4035f4b9099e96e4732 (patch)
tree4845010e64306e5abe3bcd1be27569d9c09e91bb /generic/tclCmdAH.c
parentea543514a76dcfffcd2d1f5e8dabd47f53d5c442 (diff)
downloadtcl-1d90d3f1d30da3d67a75b4035f4b9099e96e4732.zip
tcl-1d90d3f1d30da3d67a75b4035f4b9099e96e4732.tar.gz
tcl-1d90d3f1d30da3d67a75b4035f4b9099e96e4732.tar.bz2
* generic/tclCmdAH.c: Revised direct evaluation implementation of
[expr] so that [expr $e] caches compiled bytecodes for the expression as the intrep of $e.
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index cc88745..1c2e7ce 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.91 2007/12/13 15:23:15 dgp Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.92 2008/03/07 19:15:57 dgp Exp $
*/
#include "tclInt.h"
@@ -757,7 +757,6 @@ Tcl_ExprObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *CONST objv[]) /* Argument objects. */
{
- register Tcl_Obj *objPtr;
Tcl_Obj *resultPtr;
int result;
@@ -766,10 +765,14 @@ Tcl_ExprObjCmd(
return TCL_ERROR;
}
- objPtr = Tcl_ConcatObj(objc-1, objv+1);
- Tcl_IncrRefCount(objPtr);
- result = Tcl_ExprObj(interp, objPtr, &resultPtr);
- Tcl_DecrRefCount(objPtr);
+ if (objc == 2) {
+ result = Tcl_ExprObj(interp, objv[1], &resultPtr);
+ } else {
+ Tcl_Obj *objPtr = Tcl_ConcatObj(objc-1, objv+1);
+ Tcl_IncrRefCount(objPtr);
+ result = Tcl_ExprObj(interp, objPtr, &resultPtr);
+ Tcl_DecrRefCount(objPtr);
+ }
if (result == TCL_OK) {
Tcl_SetObjResult(interp, resultPtr);