summaryrefslogtreecommitdiffstats
path: root/match.c
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
commit176185cd6530bad1f8c3b36fe54bcab7580260ff (patch)
tree69117f929e8548e1633988f706b77522fc59e13e /match.c
parent49b4cbfde3f6e9950acd5fd93a450eba0c1a359a (diff)
downloadtxr-176185cd6530bad1f8c3b36fe54bcab7580260ff.tar.gz
txr-176185cd6530bad1f8c3b36fe54bcab7580260ff.tar.bz2
txr-176185cd6530bad1f8c3b36fe54bcab7580260ff.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.
Diffstat (limited to 'match.c')
-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);