diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-15 19:59:28 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-15 19:59:28 -0800 |
commit | 7bcd35fa7204a8bf1a043a2587f2e0f252764364 (patch) | |
tree | f916ad11f8e2f221dcec43cc65c40ac7098da517 /parser.c | |
parent | 0ad39c1d30de392efaf24a70da00734ea49679e8 (diff) | |
download | txr-7bcd35fa7204a8bf1a043a2587f2e0f252764364.tar.gz txr-7bcd35fa7204a8bf1a043a2587f2e0f252764364.tar.bz2 txr-7bcd35fa7204a8bf1a043a2587f2e0f252764364.zip |
Dump deferred warnings in eval_intrinsic.
* eval.c (eval_intrinsic): Dump deferred warnings after
expansion, unless in the middle of a load.
* parser.c (read_eval_ret_last): Bind *load-recursive* around
all evaluations to t, then dump warnings if prior value
of *load-recursive* is nil. Thus the repl's :read feature
behaves like load.
(repl_warning): We can now unconditionally defer deferrable
warnings here now, whether or not in a load.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -873,6 +873,9 @@ 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 saved_dyn_env = set_dyn_env(make_env(nil, nil, dyn_env)); + env_vbind(dyn_env, load_recursive_s, t); for (;; lineno = succ(lineno)) { val form = lisp_parse(in_stream, out_stream, error_val, name, lineno); @@ -890,6 +893,11 @@ static val read_eval_ret_last(val env, val counter, break; } + dyn_env = saved_dyn_env; + + if (!loading) + uw_dump_deferred_warnings(out_stream); + prinl(value, out_stream); return t; } @@ -910,9 +918,8 @@ static val get_home_path(void) static val repl_warning(val out_stream, val exc, struct args *rest) { val args = args_get_list(rest); - val loading = cdr(lookup_var(dyn_env, load_recursive_s)); - if (loading && cdr(args)) + if (cdr(args)) uw_defer_warning(args); else format(out_stream, lit("** warning: ~!~a\n"), car(args), nao); |