summaryrefslogtreecommitdiffstats
path: root/eval.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 /eval.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 'eval.c')
-rw-r--r--eval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 487df9d7..e1580641 100644
--- a/eval.c
+++ b/eval.c
@@ -311,7 +311,7 @@ static void eval_exception(val sym, val ctx, val fmt, int ex_time, va_list vl)
msg = get_string_from_stream(stream);
if (ex_time) {
- val loading = cdr(lookup_var(dyn_env, load_recursive_s));
+ val loading = cdr(lookup_var(nil, load_recursive_s));
val error_caught = uw_find_frame(error_s, catch_frame_s);
if (loading && !error_caught) {
@@ -1557,7 +1557,7 @@ static val expand_eval(val form, val env, val menv)
val lfe_save = last_form_evaled;
val form_ex = (last_form_evaled = nil,
expand(form, menv));
- val loading = cdr(lookup_var(dyn_env, load_recursive_s));
+ val loading = cdr(lookup_var(nil, load_recursive_s));
val ret = ((void) (loading || uw_release_deferred_warnings()),
eval(form_ex, default_null_arg(env), form));
last_form_evaled = lfe_save;
@@ -4629,7 +4629,7 @@ val load(val target)
val txr_lisp_p = t;
val saved_dyn_env = dyn_env;
val load_dyn_env = make_env(nil, nil, dyn_env);
- val rec = cdr(lookup_var(saved_dyn_env, load_recursive_s));
+ val rec = cdr(lookup_var(nil, load_recursive_s));
open_txr_file(path, &txr_lisp_p, &name, &stream, self);