From e55cc6a24144875732b16ff526ed7b6faea7c67a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 3 Sep 2021 07:16:31 -0700 Subject: lookup_var: don't pass dyn_env explicitly. Since lookup_var(nil, ...) skips the environment and goes for dyn_env, there is no need to pass dyn_env explicitly; it's a bit of an anti-pattern. The argument is intended for lexical scopes. * eval.c (eval_exception, expand_eval, load): Pass nil to lookup_var instead of the current dynamic environment. * match.c (v_load): Likewise. * parser.c (txr_parse, read_eval_ret_last): Likewise. --- parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 4a85fa1c..527b94c3 100644 --- a/parser.c +++ b/parser.c @@ -827,7 +827,7 @@ val txr_parse(val source_in, val error_stream, val saved_dyn = dyn_env; val parser_obj = ensure_parser(input_stream, name); parser_t *pi = parser_get_impl(self, parser_obj); - val loading = cdr(lookup_var(dyn_env, load_recursive_s)); + val loading = cdr(lookup_var(nil, load_recursive_s)); uw_simple_catch_begin; @@ -1173,7 +1173,7 @@ static val read_eval_ret_last(val env, val counter, val error_val = gensym(nil); val name = format(nil, lit("paste-~a"), counter, nao); val value = nil; - val loading = cdr(lookup_var(dyn_env, load_recursive_s)); + val loading = cdr(lookup_var(nil, load_recursive_s)); val saved_dyn_env = set_dyn_env(make_env(nil, nil, dyn_env)); env_vbind(dyn_env, load_recursive_s, t); -- cgit v1.2.3