mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Fix syntax error for a missing package name
This commit is contained in:
+8
-2
@@ -5428,8 +5428,14 @@ ParseFileError process_imported_file(Parser *p, ImportedFile const &imported_fil
|
|||||||
|
|
||||||
if (pkg->name.len == 0) {
|
if (pkg->name.len == 0) {
|
||||||
pkg->name = file->package_name;
|
pkg->name = file->package_name;
|
||||||
} else if (file->tokens.count > 0 && pkg->name != file->package_name) {
|
} else if (pkg->name != file->package_name) {
|
||||||
syntax_error(file->package_token, "Different package name, expected '%.*s', got '%.*s'", LIT(pkg->name), LIT(file->package_name));
|
if (file->tokens.count > 0 && file->tokens[0].kind != Token_EOF) {
|
||||||
|
Token tok = file->package_token;
|
||||||
|
tok.pos.file_id = file->id;
|
||||||
|
tok.pos.line = gb_max(tok.pos.line, 1);
|
||||||
|
tok.pos.column = gb_max(tok.pos.column, 1);
|
||||||
|
syntax_error(tok, "Different package name, expected '%.*s', got '%.*s'", LIT(pkg->name), LIT(file->package_name));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p->total_line_count += file->tokenizer.line_count;
|
p->total_line_count += file->tokenizer.line_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user