From c37878302934f9d372e327612bef37da1c8e3a65 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 14 Jan 2026 23:08:01 +0900 Subject: feat: add source location to error messages for undefined symbols --- src/parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/parse.c') diff --git a/src/parse.c b/src/parse.c index d590df6..2818082 100644 --- a/src/parse.c +++ b/src/parse.c @@ -385,7 +385,7 @@ static AstNode* parse_primary_expr(Parser* p) { AstNode* e = ast_new(AstNodeKind_func_call); int func_idx = find_func(p, name); if (func_idx == -1) { - fatal_error("undefined function: %s", name); + fatal_error("%s:%d: undefined function: %s", t->loc.filename, t->loc.line, name); } e->name = name; e->ty = p->funcs.data[func_idx].ty->result; @@ -400,7 +400,7 @@ static AstNode* parse_primary_expr(Parser* p) { if (enum_member_idx == -1) { int func_idx = find_func(p, name); if (func_idx == -1) { - fatal_error("undefined variable: %s", name); + fatal_error("%s:%d: undefined variable: %s", t->loc.filename, t->loc.line, name); } AstNode* e = ast_new(AstNodeKind_func); e->name = name; -- cgit v1.3-1-g0d28