From 952a5ec9289a2f9d8a95f76357906d1dcbe39966 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 26 Jun 2024 23:00:15 +0200 Subject: Make check more correct --- src/analyzer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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", -- cgit v1.2.3