mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Forbid private test cases
This commit is contained in:
@@ -4110,6 +4110,7 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
|||||||
bool is_test = false;
|
bool is_test = false;
|
||||||
bool is_init = false;
|
bool is_init = false;
|
||||||
bool is_fini = false;
|
bool is_fini = false;
|
||||||
|
bool is_priv = false;
|
||||||
|
|
||||||
for_array(i, vd->attributes) {
|
for_array(i, vd->attributes) {
|
||||||
Ast *attr = vd->attributes[i];
|
Ast *attr = vd->attributes[i];
|
||||||
@@ -4154,6 +4155,8 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
|||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
error(value, "'%.*s' expects no parameter, or a string literal containing \"file\" or \"package\"", LIT(name));
|
error(value, "'%.*s' expects no parameter, or a string literal containing \"file\" or \"package\"", LIT(name));
|
||||||
|
} else {
|
||||||
|
is_priv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4175,6 +4178,11 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_priv && is_test) {
|
||||||
|
error(decl, "Attribute 'private' is not allowed on a test case");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (entity_visibility_kind == EntityVisiblity_Public &&
|
if (entity_visibility_kind == EntityVisiblity_Public &&
|
||||||
(c->scope->flags&ScopeFlag_File) &&
|
(c->scope->flags&ScopeFlag_File) &&
|
||||||
c->scope->file) {
|
c->scope->file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user