From e6fa86985af283622d28613ab46b87fc7c5a4685 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Tue, 26 Mar 2024 04:47:38 -0400 Subject: fix submod search --- compiler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler.c b/compiler.c index 24359d9..da2bd70 100644 --- a/compiler.c +++ b/compiler.c @@ -2279,7 +2279,11 @@ void *mod_find_rec(Module *mod, Artifact *art, size_t sub, int find_type) { void *out = NULL; for (size_t i = 0; i < mod->submods.count; i++) { Module *m = vect_get(&(mod->submods), i); - if (strcmp(m->name, *to_check) == 0 || strcmp(m->name, e_check.data) == 0 || strcmp(m->name, t_check.data)) { + if ( + strcmp(m->name, *to_check) == 0 || + strcmp(m->name, e_check.data) == 0 || + strcmp(m->name, t_check.data) == 0 + ) { out = mod_find_rec(m, art, sub + 1, find_type); break; } @@ -4704,6 +4708,7 @@ Variable _eval_dot(Scope *s, CompData *data, Vector *tokens, size_t start, size_ if (v.name == NULL) { Function *f = mod_find_func(s->current, &name); if (f == NULL) { + t = vect_get(tokens, start - 1); printf("ERROR: Could not find function \"%s\" (%d:%d)\n\n", t->data, t->line, t->col); art_end(&name); return v; @@ -4712,6 +4717,7 @@ Variable _eval_dot(Scope *s, CompData *data, Vector *tokens, size_t start, size_ } else { Function *m = mod_find_func(v.type->module, &name); if (m == NULL) { + t = vect_get(tokens, start - 1); printf("ERROR: Could not find function \"%s\" (%d:%d)\n\n", t->data, t->line, t->col); art_end(&name); return v; -- cgit v1.2.3