diff options
Diffstat (limited to 'src/parser/parser_stmt.c')
| -rw-r--r-- | src/parser/parser_stmt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 24dfa10..6f93dbf 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -3725,6 +3725,14 @@ ASTNode *parse_import(ParserContext *ctx, Lexer *l) } } + // Canonicalize path to avoid duplicates (for example: "./std/io.zc" vs "std/io.zc") + char *real_fn = realpath(fn, NULL); + if (real_fn) + { + free(fn); + fn = real_fn; + } + // Check if file already imported if (is_file_imported(ctx, fn)) { |
