Add -vet-packages:<comma-separated-string-array>

This commit is contained in:
gingerBill
2024-09-17 11:01:26 +01:00
parent abf6ea7732
commit 19c1ed154c
4 changed files with 54 additions and 26 deletions

View File

@@ -1,10 +1,28 @@
#include "parser_pos.cpp"
gb_internal bool in_vet_packages(AstFile *file) {
if (file == nullptr) {
return true;
}
if (file->pkg == nullptr) {
return true;
}
if (build_context.vet_packages.entries.count == 0) {
return true;
}
return string_set_exists(&build_context.vet_packages, file->pkg->name);
}
gb_internal u64 ast_file_vet_flags(AstFile *f) {
if (f != nullptr && f->vet_flags_set) {
return f->vet_flags;
}
return build_context.vet_flags;
bool found = in_vet_packages(f);
if (found) {
return build_context.vet_flags;
}
return 0;
}
gb_internal bool ast_file_vet_style(AstFile *f) {
@@ -5372,18 +5390,9 @@ gb_internal Ast *parse_stmt(AstFile *f) {
}
gb_internal u64 check_vet_flags(AstFile *file) {
if (file && file->vet_flags_set) {
return file->vet_flags;
}
return build_context.vet_flags;
}
gb_internal void parse_enforce_tabs(AstFile *f) {
// Checks to see if tabs have been used for indentation
if ((check_vet_flags(f) & VetFlag_Tabs) == 0) {
if ((ast_file_vet_flags(f) & VetFlag_Tabs) == 0) {
return;
}