summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-09-03 07:16:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-09-03 07:16:31 -0700
commite55cc6a24144875732b16ff526ed7b6faea7c67a (patch)
tree1c7fe8328b23ff504aff992ebf3f865ee9ed87f6 /parser.c
parentc8d5fd566e7acc5ed3f42d210d4f494efde0772b (diff)
downloadtxr-e55cc6a24144875732b16ff526ed7b6faea7c67a.tar.gz
txr-e55cc6a24144875732b16ff526ed7b6faea7c67a.tar.bz2
txr-e55cc6a24144875732b16ff526ed7b6faea7c67a.zip
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.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c4
1 files changed, 2 insertions, 2 deletions
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);