# Zir: make src_node of type declarations non-optional · gitcafe/zig

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

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

Visibility: public

Requested revision: 260c84535546c81028cf42f1eb6ec9f17275db0f

Requested commit: 260c84535546c81028cf42f1eb6ec9f17275db0f

Commit: 260c84535546c81028cf42f1eb6ec9f17275db0f

Tree: 566fd6156bbbbed22741b0d94b996542ee334ae6

Author: mlugg

Committer: mlugg

## Message

```
Zir: make src_node of type declarations non-optional

Previously, the `src_node` field of `struct_decl`, `union_decl`,
`enum_decl`, and `opaque_decl` was optional, included in trailing data
only if a flag in `Small` was set. However, this was unnecessary logic:
AstGen always provided the source node. We can simplify a few bits of
logic by making this field non-optional, moving it into non-trailing
data.

There was one place where the field was actually omitted before: the
root struct of a file was at source node 0, so the node was
coincidentally elided. Therefore, this commit has a fixed cost of 4
bytes of ZIR per file.

```

## Parents

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

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