summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index dfab185..65d4f39 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -4853,7 +4853,7 @@ TclLogCommandInfo(
{
register const char *p;
Interp *iPtr = (Interp *) interp;
- int overflow, limit = 150;
+ int overflow, limit = 150, line;
Var *varPtr, *arrayPtr;
if (iPtr->flags & ERR_ALREADY_LOGGED) {
@@ -4867,12 +4867,18 @@ TclLogCommandInfo(
if (command != NULL) {
/*
- * Compute the line number where the error occurred.
+ * Compute the line number where the error occurred, honoring #line
+ * directives generated by the L compiler.
*/
iPtr->errorLine = 1;
+ if (!strncmp(script,"#line ",6) && ((line = strtoul(script+6,NULL,10)) > 0)) {
+ iPtr->errorLine = line - 1;
+ }
for (p = script; p != command; p++) {
- if (*p == '\n') {
+ if (!strncmp(p,"\n#line ",7) && ((line = strtoul(p+7,NULL,10)) > 0)) {
+ iPtr->errorLine = line - 1;
+ } else if (*p == '\n') {
iPtr->errorLine++;
}
}