# astgen: generate correct switch prong indices · gitcafe/zig

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

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

Visibility: public

Requested revision: 25012ab3d12ac7bcd4e53a90367afc8e97d91c36

Requested commit: 25012ab3d12ac7bcd4e53a90367afc8e97d91c36

Commit: 25012ab3d12ac7bcd4e53a90367afc8e97d91c36

Tree: 23a034934cd1d6ec3676b0d0aca9c092ae7e1b6d

Author: Robin Voetter

Committer: Andrew Kelley

## Message

```
astgen: generate correct switch prong indices

Switch prong values are fetched by index in semantic analysis by prong
offset, but these were computed as capture offset. This means that a switch
where the first prong does not capture and the second does, the switch_capture
zir instruction would be assigned switch_prong 0 instead of 1.

```

## Parents

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

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