diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 37 | ||||
-rw-r--r-- | generic/tclCmdIL.c | 4 | ||||
-rw-r--r-- | generic/tclCompile.c | 10 |
3 files changed, 30 insertions, 21 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 1a24a29..c91fdc1 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.75.2.31 2008/07/22 22:46:09 andreas_kupries Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.75.2.32 2008/07/23 20:45:16 andreas_kupries Exp $ */ #include "tclInt.h" @@ -4573,6 +4573,17 @@ TclArgumentGet(interp,obj,cfPtrPtr,wordPtr) CmdFrame* framePtr; /* + * An object which either has no string rep guaranteed to have been + * generated dynamically: bail out, this cannot have a usable absolute + * location. _Do not touch_ the information the set up by the caller. It + * knows better than us. + */ + + if (!obj->bytes) { + return; + } + + /* * First look for location information recorded in the argument * stack. That is nearest. */ @@ -4782,7 +4793,6 @@ TclEvalObjEx(interp, objPtr, flags, invoker, word) * As we know that this is dynamic execution we ignore the * invoker, even if known. */ - int line; CmdFrame eoFrame; eoFrame.type = TCL_LOCATION_EVAL_LIST; @@ -4791,8 +4801,8 @@ TclEvalObjEx(interp, objPtr, flags, invoker, word) iPtr->cmdFramePtr->level + 1); eoFrame.framePtr = iPtr->framePtr; eoFrame.nextPtr = iPtr->cmdFramePtr; - eoFrame.nline = objc; - eoFrame.line = (int*) ckalloc (objc * sizeof (int)); + eoFrame.nline = 0; + eoFrame.line = NULL; /* NOTE: Getting the string rep of the list to eval to fill the * command information required by 'info frame' implies that @@ -4815,23 +4825,18 @@ TclEvalObjEx(interp, objPtr, flags, invoker, word) * Copy the list elements here, to avoid a segfault if * objPtr loses its List internal rep [Bug 1119369]. * - * TIP #280 Computes all the line numbers for the - * words in the command. + * TIP #280 We do _not_ compute all the line numbers for the words + * in the command. For the eval of a pure list the most sensible + * choice is to put all words on line 1. Given that we neither + * need memory for them nor compute anything. 'line' is left + * NULL. The two places using this information (TclInfoFrame, and + * TclInitCompileEnv), are special-cased to use the proper line + * number directly instead of accessing the 'line' array. */ -#ifdef TCL_TIP280 - line = 1; -#endif for (i=0; i < objc; i++) { objv[i] = listRepPtr->elements[i]; Tcl_IncrRefCount(objv[i]); -#ifdef TCL_TIP280 - eoFrame.line [i] = line; - { - char* w = Tcl_GetString (objv [i]); - TclAdvanceLines (&line, w, w+ strlen(w)); - } -#endif } #ifdef TCL_TIP280 diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 54359af..7bf46fb 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.15 2008/07/07 21:39:22 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.16 2008/07/23 20:45:17 andreas_kupries Exp $ */ #include "tclInt.h" @@ -1153,7 +1153,7 @@ InfoFrameCmd(dummy, interp, objc, objv) lv [lc ++] = Tcl_NewStringObj ("type",-1); lv [lc ++] = Tcl_NewStringObj (typeString [framePtr->type],-1); lv [lc ++] = Tcl_NewStringObj ("line",-1); - lv [lc ++] = Tcl_NewIntObj (framePtr->line[0]); + lv [lc ++] = Tcl_NewIntObj (1); /* We put a duplicate of the command list obj into the result * to ensure that the 'pure List'-property of the command diff --git a/generic/tclCompile.c b/generic/tclCompile.c index a49297c..59be33a 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompile.c,v 1.43.2.11 2008/07/22 22:30:05 andreas_kupries Exp $ + * RCS: @(#) $Id: tclCompile.c,v 1.43.2.12 2008/07/23 20:45:18 andreas_kupries Exp $ */ #include "tclInt.h" @@ -818,8 +818,12 @@ TclInitCompileEnv(interp, envPtr, string, numBytes, invoker, word) envPtr->extCmdMapPtr->neiloc = 0; envPtr->extCmdMapPtr->nueiloc = 0; - if (invoker == NULL) { - /* Initialize the compiler for relative counting */ + if (invoker == NULL || + (invoker->type == TCL_LOCATION_EVAL_LIST)) { + /* + * Initialize the compiler for relative counting in case of a + * dynamic context. + */ envPtr->line = 1; envPtr->extCmdMapPtr->type = (envPtr->procPtr |