summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-04-14 06:53:20 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-04-14 06:53:20 -0700
commitdb4cab95813e28e95d76a55b1f2c032521d92c86 (patch)
tree11b12cf848bcbf1589b608bd0c78e8692b42928d
parenta506664be6f93a51152cb7c25fad1f9466ebc78c (diff)
downloadtxr-db4cab95813e28e95d76a55b1f2c032521d92c86.tar.gz
txr-db4cab95813e28e95d76a55b1f2c032521d92c86.tar.bz2
txr-db4cab95813e28e95d76a55b1f2c032521d92c86.zip
load: release warnings before throwing exception.
* eval.c (load): When we parse TXR code, let's not release warnings unconditionally. Let's do that when throwing an exception though due to parse errors. If the load is not recursed it will release warnings at the bottom of the function. * match.c (v_load): Consistently with load, release deferred warnings if throwing exception due to the parse having failed.
-rw-r--r--eval.c7
-rw-r--r--match.c4
2 files changed, 7 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index b7cc387d..7b3a765d 100644
--- a/eval.c
+++ b/eval.c
@@ -4444,11 +4444,12 @@ val load(val target)
close_stream(stream, nil);
- uw_release_deferred_warnings();
-
- if (parser->errors)
+ if (parser->errors) {
+ uw_release_deferred_warnings();
uw_throwf(query_error_s, lit("~a: parser errors in ~a"),
self, path, nao);
+ }
+
{
val match_ctx = uw_get_match_context();
val bindings = cdr(match_ctx);
diff --git a/match.c b/match.c
index 5a711b1b..86156193 100644
--- a/match.c
+++ b/match.c
@@ -4408,8 +4408,10 @@ static val v_load(match_files_ctx *c)
parse_once(self, stream, name);
gc_state(gc);
- if (parser->errors)
+ if (parser->errors) {
+ uw_release_deferred_warnings();
sem_error(specline, lit("~s: errors encountered in ~a"), sym, path, nao);
+ }
if (sym == include_s) {
ret = parser->syntax_tree;