sema: use ast field here, add assertion

This commit is contained in:
tocariimaa 2025-01-21 14:36:18 -03:00
parent 632fe260fe
commit db91cf09fc

View file

@ -709,10 +709,11 @@ sema_var_decl(SemaCtx *sctx, AstVarDecl *decl, Location loc)
compiler_assert(sctx->cm, dexpr_dt != nil); compiler_assert(sctx->cm, dexpr_dt != nil);
decl->type = dexpr_dt; decl->type = dexpr_dt;
} }
compiler_assert(sctx->cm, decl->type != nil);
Symbol sym = { Symbol sym = {
.kind = decl->kind, .kind = decl->kind,
.dtype = dtype, .dtype = decl->type,
.loc = loc, .loc = loc,
}; };
/* Insert the variable to the symbol table */ /* Insert the variable to the symbol table */