diff options
| author | gingerBill <bill@gingerbill.org> | 2024-09-17 11:01:26 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-09-17 11:01:26 +0100 |
| commit | 19c1ed154cc9e36433fe23e1e34810f9c53ec01d (patch) | |
| tree | 754047ce507c8cc7859a4f94f5bdef13618f466d /src/parser.cpp | |
| parent | abf6ea7732b855dcb0ddb549a6454f99c40b7328 (diff) | |
Add `-vet-packages:<comma-separated-string-array>`
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 88147d465..56bea8131 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -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; } |