From 1d90d3f1d30da3d67a75b4035f4b9099e96e4732 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 7 Mar 2008 19:15:57 +0000 Subject: * generic/tclCmdAH.c: Revised direct evaluation implementation of [expr] so that [expr $e] caches compiled bytecodes for the expression as the intrep of $e. --- ChangeLog | 4 ++++ generic/tclCmdAH.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2555cc..ea36890 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-03-07 Don Porter + * 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); -- cgit v0.12