diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-26 23:00:15 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-26 23:00:15 +0200 |
commit | 952a5ec9289a2f9d8a95f76357906d1dcbe39966 (patch) | |
tree | 9d51b1fbc3dc404a139b684d18088d716f4fcd09 /src | |
parent | 44e8d5650393c4440bc6e2086520c6d7b0787caa (diff) |
Make check more correct
Diffstat (limited to 'src')
-rw-r--r-- | src/analyzer.c | 7 |
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", |