summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-02-13 20:00:25 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-02-13 20:00:25 -0800
commited86d5e4ab4996b12c3a3f20043ab364d8e00652 (patch)
tree69117f929e8548e1633988f706b77522fc59e13e
parent980e782e8973fa48fb3f4533dd731d75eb3d9287 (diff)
downloadtxr-ed86d5e4ab4996b12c3a3f20043ab364d8e00652.tar.gz
txr-ed86d5e4ab4996b12c3a3f20043ab364d8e00652.tar.bz2
txr-ed86d5e4ab4996b12c3a3f20043ab364d8e00652.zip
@(line): get meaningful value in horizontal mode.
When @(line var) is used in a horizontal match, line is bound to zero. This is because the line number isn't being propagated. * match.c (mf_from_ml): Both the file and line context structurs have a data_lineno, yet this function doesn't propagate it. Instead of using ml_all, whose name tells a subtle lie since it neglects the data_lineno, let's just do the member for member logic here. This function is used in one place, the hv_trampoline. So this fixes the line number for all vertical directives called out of horizontal context.
-rw-r--r--match.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/match.c b/match.c
index 30f26137..c08464a4 100644
--- a/match.c
+++ b/match.c
@@ -2305,7 +2305,16 @@ static match_files_ctx mf_file_data(match_files_ctx c, val file,
static match_files_ctx mf_from_ml(match_line_ctx ml)
{
- return mf_all(cons(ml.specline, nil), nil, ml.bindings, nil, ml.file);
+ match_files_ctx mf;
+
+ mf.spec = cons(ml.specline, nil);
+ mf.files = nil;
+ mf.curfile = ml.file;
+ mf.bindings = ml.bindings;
+ mf.data = nil;
+ mf.data_lineno = ml.data_lineno;
+
+ return mf;
}
static val match_files(match_files_ctx a);