summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-10-25 07:54:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-10-25 07:54:39 -0700
commit02a73c7785f5cdd7975cf10f83b430dfcc6778a3 (patch)
tree1255f56579ab82d05b164415e9bbcea1d4f2f15f /parser.c
parent76b97f2c904c4e52d11e89406a9491aef77ef438 (diff)
downloadtxr-02a73c7785f5cdd7975cf10f83b430dfcc6778a3.tar.gz
txr-02a73c7785f5cdd7975cf10f83b430dfcc6778a3.tar.bz2
txr-02a73c7785f5cdd7975cf10f83b430dfcc6778a3.zip
repl: bugfix: half-baked source auto loading in completion.
The following behavior is observed. When we clean the compiled files using "make clean-tlo", then autoloading during completion does not work reliably for some symbols like dissassemble and compile. The symbols don't complete, and afterward, the functions remain undefined, and no longer autoload. The root cause is that when some modules are loaded form source, deferred warnings occur, due to code referring to symbols that are defined later. But the provide_completions function installs a catch for all exceptions, including deferred warnings. It thereby abruptly terminates loads which trigger deferred warnings, leaving them half-complete. The fix is to catch only errors. * parser.c (catch_error): New global variable. (load_rcfile): Use catch_error from now on instead of locally consing this. (provide_completions): Use catch_error instead of catch_all. (parse_init): gc-protect catch_error and initialize it.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/parser.c b/parser.c
index 3a14d4ed..060643b4 100644
--- a/parser.c
+++ b/parser.c
@@ -80,7 +80,7 @@ struct cobj_class *parser_cls;
static lino_t *lino_ctx;
static int repl_level = 0;
-static val stream_parser_hash, catch_all;
+static val stream_parser_hash, catch_all, catch_error;
static void yy_tok_mark(struct yy_token *tok)
{
@@ -888,10 +888,9 @@ static void load_rcfile(val name)
val resolved_name;
val lisp_p = t;
val stream = nil;
- val catch_syms = cons(error_s, nil);
val path_private_to_me_p = intern(lit("path-private-to-me-p"), user_package);
- uw_catch_begin (catch_syms, sy, va);
+ uw_catch_begin (catch_error, sy, va);
open_txr_file(name, &lisp_p, &resolved_name, &stream, self);
@@ -1028,7 +1027,7 @@ static void provide_completions(const wchar_t *data,
(void) ctx;
- uw_catch_begin (catch_all, exsym, exvals);
+ uw_catch_begin (catch_error, exsym, exvals);
if (!ptr)
goto out;
@@ -1898,9 +1897,11 @@ void parse_init(void)
parser_cls = cobj_register(parser_s);
- protect(&stream_parser_hash, &unique_s, &catch_all, convert(val *, 0));
+ protect(&stream_parser_hash, &unique_s,
+ &catch_all, &catch_error, convert(val *, 0));
stream_parser_hash = make_hash(hash_weak_and, nil);
catch_all = cons(t, nil);
+ catch_error = cons(error_s, nil);
parser_l_init();