diff options
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 7f56770b9..c2318e499 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -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; |