aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-01-15 16:15:03 +0000
committergingerBill <bill@gingerbill.org>2021-01-15 16:15:03 +0000
commitc653e400dbb011965583a34951763173b0fc7969 (patch)
treefe9e8c6561b7f5156652b07997f067d920b3fa92 /src/parser.cpp
parente884f8c165fac7df366a95e5b8f565a375199233 (diff)
Add extra error checking in parser.cpp
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 59d02090e..2f59d736c 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -5320,6 +5320,7 @@ ParseFileError process_imported_file(Parser *p, ImportedFile const &imported_fil
TokenPos err_pos = {0};
ParseFileError err = init_ast_file(file, fi->fullpath, &err_pos);
err_pos.file = fi->fullpath;
+ file->last_error = err;
if (err != ParseFile_None) {
if (err == ParseFile_EmptyFile) {
@@ -5426,6 +5427,18 @@ ParseFileError parse_packages(Parser *p, String init_filename) {
}
}
+ for (isize i = p->packages.count-1; i >= 0; i--) {
+ AstPackage *pkg = p->packages[i];
+ for (isize j = pkg->files.count-1; j >= 0; j--) {
+ AstFile *file = pkg->files[j];
+ if (file->error_count != 0) {
+ if (file->last_error != ParseFile_None) {
+ return file->last_error;
+ }
+ return ParseFile_GeneralError;
+ }
+ }
+ }
return ParseFile_None;
}