commit 3a7547374cad9be722171c9f51ecf1889565559f
parent 7e98928fea1c93612dda1ff96538dc8b7c41d0f6
Author: Lou Woell <lou.woell@posteo.de>
Date:   Wed, 10 Sep 2025 18:16:38 +0200

Simplify resolver logic

Diffstat:
Mcmd/harehelper/resolve.ha | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/cmd/harehelper/resolve.ha b/cmd/harehelper/resolve.ha @@ -73,14 +73,15 @@ fn find_uid (id: ast::ident, path: str) (void | ast::ident) = { for (let i .. imports) { let ident = i.ident; - let check = false; let ns = ident_ns(id); + let check = false; let interned = false; match (i.bindings) { case let a: ast::import_alias => - ident = [a]; + if (ns[0] == a) check = true; case let members: ast::import_members => + // if len(id) > 1 -> id is not an interned symbol. if (len(id) > 1) continue; for (let s .. members) { check = (s == id[0]); @@ -92,16 +93,13 @@ fn find_uid (id: ast::ident, path: str) (void | ast::ident) = { case ast::import_wildcard => // todo check all symbols; void; - case void => void; - }; - - if (!check) { - check = ast::ident_eq(ns, ident) || - ast::ident_eq(ns, ident_last(ident)); + case void => + if (ast::ident_eq(ns, ident_last(ident))) + check = true; }; if (check) { - let id_exp = ast::ident_dup(i.ident); + let id_exp = ast::ident_dup(ident); if (len(id) > 1 || interned) { let end = ident_last(id); let id_end = ast::ident_dup(end);