diff options
| -rw-r--r-- | src/parse.c | 4 | ||||
| -rw-r--r-- | tests/compile_errors.sh | 2 |
2 files changed, 3 insertions, 3 deletions
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; diff --git a/tests/compile_errors.sh b/tests/compile_errors.sh index c41d633..e99282b 100644 --- a/tests/compile_errors.sh +++ b/tests/compile_errors.sh @@ -1,5 +1,5 @@ cat <<'EOF' > expected -undefined function: f +main.c:2: undefined function: f EOF test_compile_error <<'EOF' int main() { |
