Fix -vet-packages not working in certain cases

This commit is contained in:
Sylphrena
2026-08-04 12:36:20 +02:00
parent 14007d51d3
commit 5629c13aa0

View File

@@ -6,13 +6,35 @@ gb_internal bool in_vet_packages(AstFile *file) {
if (file == nullptr) {
return true;
}
if (file->pkg == nullptr) {
return true;
}
if (file->pkg_decl == nullptr) {
return true;
}
if (build_context.vet_packages.entries.count == 0) {
return true;
}
return string_set_exists(&build_context.vet_packages, file->pkg->name);
String pkg_name = {};
if (file->pkg->name.len > 0) {
pkg_name = file->pkg->name;
} else if (file->pkg_decl->kind == Ast_PackageDecl) {
Token name_token = file->pkg_decl->PackageDecl.name;
if (name_token.kind == Token_Ident) {
pkg_name = name_token.string;
}
}
if (pkg_name.len == 0) {
return true;
}
return string_set_exists(&build_context.vet_packages, pkg_name);
}
gb_internal u64 ast_file_vet_flags(AstFile *f) {