# lazy analysis of top level declarations · gitcafe/zig

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

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

Visibility: public

Requested revision: fa7c64ccd511703fef9971c4d07c447c9aeda49c

Requested commit: fa7c64ccd511703fef9971c4d07c447c9aeda49c

Commit: fa7c64ccd511703fef9971c4d07c447c9aeda49c

Tree: 6f41eb742160ec1584b6adb719ec1327f9e3c831

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
lazy analysis of top level declarations

previously, we had lazy analysis of top level declarations,
but if a declaration was referenced within a compile-time
if or switch statement, that would still add the top
level declaration to the resolution queue.

now we have a declref ir instruction, which is only resolved
if we analyze the instruction. this takes into account comptime
branching.

closes #270

```

## Parents

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

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