| author | |
| committer | |
| log | 435c8ad703503e4dcc102b0907b45459d2693822 |
| tree | 2c2a1847430064d4ddb6bd4a74d1e3076ce7680f |
| parent | 1ce09948975a148e09bf405f6a899e4fb0730ce6 |
See #33282 files changed, 4 insertions(+), 5 deletions(-)
src/stage1.zig+2| ... | ... | @@ -428,5 +428,7 @@ export fn stage2_fetch_file( |
| 428 | 428 | const max_file_size = std.math.maxInt(u32); |
| 429 | 429 | const contents = comp.stage1_cache_manifest.addFilePostFetch(file_path, max_file_size) catch return null; |
| 430 | 430 | result_len.* = contents.len; |
| 431 | // TODO https://github.com/ziglang/zig/issues/3328#issuecomment-716749475 | |
| 432 | if (contents.len == 0) return @intToPtr(?[*]const u8, 0x1); | |
| 431 | 433 | return contents.ptr; |
| 432 | 434 | } |
src/stage1/analyze.cpp+2-5| ... | ... | @@ -8052,13 +8052,10 @@ not_integer: |
| 8052 | 8052 | } |
| 8053 | 8053 | |
| 8054 | 8054 | Error file_fetch(CodeGen *g, Buf *resolved_path, Buf *contents_buf) { |
| 8055 | size_t len = 0xAA; | |
| 8055 | size_t len; | |
| 8056 | 8056 | const char *contents = stage2_fetch_file(&g->stage1, buf_ptr(resolved_path), buf_len(resolved_path), &len); |
| 8057 | if (len == 0) { | |
| 8058 | // File exists but is empty (otherwise it would be 0xAA) | |
| 8059 | } else if (contents == nullptr) { | |
| 8057 | if (contents == nullptr) | |
| 8060 | 8058 | return ErrorFileNotFound; |
| 8061 | } | |
| 8062 | 8059 | buf_init_from_mem(contents_buf, contents, len); |
| 8063 | 8060 | return ErrorNone; |
| 8064 | 8061 | } |