# AstGen: incorporate extra information into source hashes · gitcafe/zig

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

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

Visibility: public

Requested revision: 43fdd061f7430794c142283101f9c97a0829d446

Requested commit: 43fdd061f7430794c142283101f9c97a0829d446

Commit: 43fdd061f7430794c142283101f9c97a0829d446

Tree: 9d37f8b99735e51b290472d45f5e9b2b61aa7b3e

Author: mlugg

Committer: mlugg

## Message

```
AstGen: incorporate extra information into source hashes

* Indices of referenced captures
* Line and column of `@src()`

The second point aligns with a reversal of the "incremental compilation"
section of https://github.com/ziglang/zig/issues/2029#issuecomment-645793168.
This reversal was already done as #17688 (46a6d50), with the idea to
push incremental compilation down the line. My proposal is to keep it as
comptime-known, and simply re-analyze uses of `@src()` whenever their
line/column change.

I think this decision is reasonable for a few reasons:

* The Zig compiler is quite fast. Occasionally re-analyzing a few
  functions containing `@src()` calls is perfectly acceptable and won't
  noticably impact update times.
* The system described by Andrew in #2029 is currently vaporware.
* The system described by Andrew in #2029 is non-trivial to implement.
  In particular, it requires some way to have backends update a single
  global in certain cases, without re-doing semantic analysis. There is
  no other part of incremental compilation which requires this.
* Having `@src().line` be comptime-known is useful. For instance, #17688
  was justified by broken Tracy integration because the source line
  couldn't be comptime-known.

```

## Parents

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

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