harden compiler parsing, recovery, and deep-expression handling

This commit is contained in:
2026-06-12 00:28:45 +02:00
parent a5ceb727c1
commit 99ba907f59
13 changed files with 1159 additions and 503 deletions
+2 -3
View File
@@ -152,13 +152,12 @@ load_package :: proc(state: ^State, path: string, import_span: source.Span, is_r
}
for file_info in files {
bytes, read_ok := os.read_entire_file(file_info.fullpath)
bytes, read_ok := os.read_entire_file(file_info.fullpath, state.sources.allocator)
if !read_ok {
state.root_failed = true
continue
}
source_id := source.add_source(state.sources, file_info.fullpath, string(bytes))
delete(bytes)
source_id := source.add_source_owned(state.sources, file_info.fullpath, bytes)
file_id := len(state.module.files)
append(&state.module.files, ast.File{source=source_id, pkg=pkg_id})
stream := lexer.lex(&state.sources.items[source_id], state.diagnostics, state.symbols, state.token_allocator)