commit ad6ff91398d83dabacc2aeda0220d61db71d55fc
parent 860bc8ef6b90263db70cbacbbdecc423dcca95dc
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 30 Sep 2023 23:36:53 -0400
haredoc: check symbol of globals
This gives them the same behavior as functions
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/cmd/haredoc/main.ha b/cmd/haredoc/main.ha
@@ -344,6 +344,11 @@ fn has_decl(decl: ast::decl, name: str) bool = {
if (len(d[i].ident) == 1 && d[i].ident[0] == name) {
return true;
};
+ const sym = strings::split(d[i].symbol, ".");
+ defer free(sym);
+ if (len(sym) > 0 && sym[len(sym) - 1] == name) {
+ return true;
+ };
};
case let d: []ast::decl_type =>
for (let i = 0z; i < len(d); i += 1) {