aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-12-26 11:49:46 +0000
committergingerBill <gingerBill@users.noreply.github.com>2025-12-26 11:49:46 +0000
commit2e6554b8c85c904eb1eb010f0312641be800823f (patch)
tree9ac684738fb6b8811f044778c2fbf7100b3a1a02 /src/parser.cpp
parent57352d9933785097e21c282807f5e845ec8f6d85 (diff)
Disallow importing directories with an `.odin` extension/suffix
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index de5655ce1..b2ff55396 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -5818,6 +5818,11 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
return nullptr;
}
+ if (string_ends_with(path, str_lit(".odin"))) {
+ error(pos, "'import' declarations cannot import directories with a .odin extension/suffix");
+ return nullptr;
+ }
+
isize files_with_ext = 0;
isize files_to_reserve = 1; // always reserve 1
for (FileInfo fi : list) {