aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/analyzer.c b/src/analyzer.c
index 5f4262a..d75efcf 100644
--- a/src/analyzer.c
+++ b/src/analyzer.c
@@ -189,7 +189,12 @@ analyzedecl(struct azctx ctx, scope_t *scps, type_t *types, ast_t ast,
aux_t aux, lexemes_t toks, idx_t i)
{
strview_t sv = toks.strs[ast.lexemes[i]];
- if (ctx.si > 0 && ast.kinds[i] == ASTDECL) {
+
+ bool isstatic = ast.kinds[i] <= _AST_DECLS_END
+ && aux.buf[ast.kids[i].lhs].decl.isstatic;
+ bool isconst = ast.kinds[i] == ASTCDECL;
+
+ if (!isconst && !isstatic) {
symval_t *sym = symtab_insert(&scps[ctx.si].map, sv, ctx.a);
if (sym->exists) {
err("analyzer: Variable ā€˜%.*sā€™ declared multiple times",