# compiler: integrate ZON with the ZIR caching system · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/55a2e535fdb663793b84769cb6c3a261bda3fc66)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 55a2e535fdb663793b84769cb6c3a261bda3fc66

Requested commit: 55a2e535fdb663793b84769cb6c3a261bda3fc66

Commit: 55a2e535fdb663793b84769cb6c3a261bda3fc66

Tree: f13faecbc0fc66c49791165cce0189382026f428

Author: mlugg

Committer: mlugg

## Message

```
compiler: integrate ZON with the ZIR caching system

This came with a big cleanup to `Zcu.PerThread.updateFile` (formerly
`astGenFile`).

Also, change how the cache manifest works for files in the import table.
Instead of being added to the manifest when we call `semaFile` on them,
we iterate the import table after running the AstGen workers and add all
the files to the cache manifest then.

The downside is that this is a bit more eager to include files in the
manifest; in particular, files which are imported but not actually
referenced are now included in analysis. So, for instance, modifying any
standard library file will invalidate all Zig compilations using that
standard library, even if they don't use that file.

The original motivation here was simply that the old logic in `semaFile`
didn't translate nicely to ZON. However, it turns out to actually be
necessary for correctness. Because `@import("foo.zig")` is an
AstGen-level error if `foo.zig` does not exist, we need to invalidate
the cache when an imported but unreferenced file is removed to make sure
this error is triggered when it needs to be.

Resolves: #22746

```

## Parents

- [0907432fffd2d9f5319022332a60fc88d3aacf4e](https://git.cafe/gitcafe/zig/commit/0907432fffd2d9f5319022332a60fc88d3aacf4e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/55a2e535fdb663793b84769cb6c3a261bda3fc66?format=markdown)
