mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-17 03:12:22 -07:00
static variable declarations (Experimental)
This commit is contained in:
@@ -2282,6 +2282,10 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
||||
e->flags |= EntityFlag_NotExported;
|
||||
}
|
||||
|
||||
if (vd->is_static) {
|
||||
e->flags |= EntityFlag_Static;
|
||||
}
|
||||
|
||||
if (vd->is_using) {
|
||||
vd->is_using = false; // NOTE(bill): This error will be only caught once
|
||||
error(name, "'using' is not allowed at the file scope");
|
||||
@@ -2386,6 +2390,14 @@ void check_collect_value_decl(CheckerContext *c, Ast *decl) {
|
||||
e->flags |= EntityFlag_NotExported;
|
||||
}
|
||||
|
||||
if (vd->is_static) {
|
||||
if (e->kind == Entity_Constant) {
|
||||
e->flags |= EntityFlag_Static;
|
||||
} else {
|
||||
error(name, "'static' is not allowed on this constant value declaration");
|
||||
}
|
||||
}
|
||||
|
||||
if (vd->is_using) {
|
||||
if (e->kind == Entity_TypeName && init->kind == Ast_EnumType) {
|
||||
d->is_using = true;
|
||||
|
||||
Reference in New Issue
Block a user