summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-07-02 07:44:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-07-02 07:44:31 -0700
commit0b027d8601b90fe78813a68ea8e3938f7c87395e (patch)
tree3d9d6eb65d96172e2573ed63ff6f706e6264fd93
parent0d399a5e521d30a758276ef55c345c493a31aa0b (diff)
downloadtxr-0b027d8601b90fe78813a68ea8e3938f7c87395e.tar.gz
txr-0b027d8601b90fe78813a68ea8e3938f7c87395e.tar.bz2
txr-0b027d8601b90fe78813a68ea8e3938f7c87395e.zip
@(define): bugfix: incorrect parameter list walk.
* parser.y (elem, define_clause): The match_reg_params function is supposed to walk the pattern function parameters, not the argument of the define directive (of which the second one is those arguments). This bug causes spurious unbound variable warnings when function bodies refer to their second or subsequent arguments. Issue reported by user vapnik spaknik.
-rw-r--r--parser.y4
1 files changed, 2 insertions, 2 deletions
diff --git a/parser.y b/parser.y
index c5e843fb..43f4f587 100644
--- a/parser.y
+++ b/parser.y
@@ -521,7 +521,7 @@ elem : texts { $$ = rlc(cons(text_s, $1), $1);
| DEFINE exprs ')' elems END
{ $$ = list(define_s, t, $4, $2, nao);
rl($$, num($1));
- match_reg_params($2); }
+ match_reg_params(second($2)); }
;
clause_parts_h : elems_opt additional_parts_h { $$ = if2($1, cons($1, $2)); }
@@ -536,7 +536,7 @@ define_clause : DEFINE exprs ')' newl
clauses_opt
END newl { $$ = list(define_s, $2, $5, nao);
rl($$, num($1));
- match_reg_params($2); }
+ match_reg_params(second($2)); }
| DEFINE ')' newl
clauses_opt
END newl { $$ = list(define_s, nil, $4, nao);