diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-09-04 23:17:38 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-09-04 23:17:38 -0400 |
| commit | b35c74ea4c9d93d6a8d90812d2066a78b9abb64e (patch) | |
| tree | 2bd1b9b8f353718c385fd6b800c1b7372840f99f /src/analyze.cpp | |
| parent | 2bf1b6840d33a27614630ddb34f53a859fc87345 (diff) | |
| download | zig-b35c74ea4c9d93d6a8d90812d2066a78b9abb64e.tar.gz zig-b35c74ea4c9d93d6a8d90812d2066a78b9abb64e.zip | |
stage1: use os_path_resolve instead of os_path_real
to canonicalize imports.
This means that softlinks can represent different files,
but referencing the same absolute path different ways
still references the same import.
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 99cd496fd9..ff7dac1abf 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -4236,9 +4236,9 @@ void preview_use_decl(CodeGen *g, AstNode *node) { node->data.use.value = result; } -ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *abs_full_path, Buf *source_code) { +ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *resolved_path, Buf *source_code) { if (g->verbose_tokenize) { - fprintf(stderr, "\nOriginal Source (%s):\n", buf_ptr(abs_full_path)); + fprintf(stderr, "\nOriginal Source (%s):\n", buf_ptr(resolved_path)); fprintf(stderr, "----------------\n"); fprintf(stderr, "%s\n", buf_ptr(source_code)); @@ -4250,7 +4250,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a tokenize(source_code, &tokenization); if (tokenization.err) { - ErrorMsg *err = err_msg_create_with_line(abs_full_path, tokenization.err_line, tokenization.err_column, + ErrorMsg *err = err_msg_create_with_line(resolved_path, tokenization.err_line, tokenization.err_column, source_code, tokenization.line_offsets, tokenization.err); print_err_msg(err, g->err_color); @@ -4268,7 +4268,7 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a import_entry->package = package; import_entry->source_code = source_code; import_entry->line_offsets = tokenization.line_offsets; - import_entry->path = abs_full_path; + import_entry->path = resolved_path; import_entry->root = ast_parse(source_code, tokenization.tokens, import_entry, g->err_color); assert(import_entry->root); @@ -4278,10 +4278,10 @@ ImportTableEntry *add_source_file(CodeGen *g, PackageTableEntry *package, Buf *a Buf *src_dirname = buf_alloc(); Buf *src_basename = buf_alloc(); - os_path_split(abs_full_path, src_dirname, src_basename); + os_path_split(resolved_path, src_dirname, src_basename); import_entry->di_file = ZigLLVMCreateFile(g->dbuilder, buf_ptr(src_basename), buf_ptr(src_dirname)); - g->import_table.put(abs_full_path, import_entry); + g->import_table.put(resolved_path, import_entry); g->import_queue.append(import_entry); import_entry->decls_scope = create_decls_scope(import_entry->root, nullptr, nullptr, import_entry); |
