Fix regression for $include.

This commit is contained in:
Christoffer Lerno
2024-09-10 12:15:45 +02:00
parent b22bd459dd
commit 6f90e13502
2 changed files with 3 additions and 2 deletions

View File

@@ -18,6 +18,7 @@
- `l[0].a = 1` now supported for overloads due to better lvalue handling #1357.
- Asserts are retained regardless of optimization when running tests.
- Limit object filename lengths. #1415
- Fix regression for `$include`.
### Stdlib changes
- Additional init functions for hashmap.

View File

@@ -150,7 +150,7 @@ INLINE File *sema_load_file(CompilationUnit *unit, SourceSpan span, Expr *filena
if (!file)
{
if (no_file) return no_file;
print_error_at(span, "Failed to load file %s: %s", string, error);
print_error_at(filename->span, "Failed to load file '%s': %s.", filename->const_expr.bytes.ptr, error);
return NULL;
}
if (compiler.context.errors_found) return NULL;
@@ -174,7 +174,7 @@ static Decl **sema_load_include(CompilationUnit *unit, Decl *decl)
}
bool success = sema_analyse_ct_expr(&context, decl->include.filename);
sema_context_destroy(&context);
if (success) return NULL;
if (!success) return NULL;
File *file = sema_load_file(unit, decl->span, decl->include.filename, "$include", NULL);
if (!file) return NULL;
if (compiler.context.includes_used++ > MAX_INCLUDE_DIRECTIVES)