diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | generic/tclCmdAH.c | 15 |
2 files changed, 13 insertions, 6 deletions
@@ -1,5 +1,9 @@ 2008-03-07 Don Porter <dgp@users.sourceforge.net> + * generic/tclCmdAH.c: Revised direct evaluation implementation of + [expr] so that [expr $e] caches compiled bytecodes for the expression + as the intrep of $e. + * tests/execute.test (execute-6.*): More tests checking that script bytecode is invalidated in the right situations. 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); |