harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9351585b504decfc316225cbf80954f0c7d27970
parent 653893e58f142313ed264ddbad3a00bdd01af180
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Thu,  9 Sep 2021 18:44:39 +0000

check: error out on unspecified declaration

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/check.c | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -70,12 +70,14 @@ static void error(struct context *ctx, const struct location loc, struct expression *expr, char *fmt, ...) { - expr->type = EXPR_CONSTANT; - // TODO: We should have a separate type for errors, to avoid spurious - // errors - expr->result = &builtin_type_void; - expr->terminates = false; - expr->loc = loc; + if (expr) { + expr->type = EXPR_CONSTANT; + // TODO: We should have a separate type for errors, to avoid + // spurious errors + expr->result = &builtin_type_void; + expr->terminates = false; + expr->loc = loc; + } va_list ap; va_start(ap, fmt); @@ -3709,6 +3711,9 @@ check_internal(struct type_store *ts, if (!cur) { if (!found) { handle_errors(ctx.errors); + error(&ctx, unresolved->unresolved->decl.loc, NULL, + "Undefined identifier used in declaration"); + handle_errors(ctx.errors); } cur = unresolved; unresolved = NULL;