# Sema: remove redundant addConstant functions · gitcafe/zig

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

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

Visibility: public

Requested revision: 5e0107fbce8f33f84af232c3edc912a81615175f

Requested commit: 5e0107fbce8f33f84af232c3edc912a81615175f

Commit: 5e0107fbce8f33f84af232c3edc912a81615175f

Tree: 1e937c9434b6502df9eff05a8175f8171985c936

Author: mlugg

Committer: Andrew Kelley

## Message

```
Sema: remove redundant addConstant functions

After ff37ccd, interned values are trivial to convert to Air refs, using
`Air.internedToRef`. This made functions like `Sema.addConstant` effectively
redundant. This commit removes `Sema.addConstant` and `Sema.addType`, replacing
them with direct usages of `Air.internedToRef`.

Additionally, a new helper `Module.undefValue` is added, and the following
functions are moved into Module:
* `Sema.addConstUndef` -> `Module.undefRef`
* `Sema.addUnsignedInt` -> `Module.intRef` (now also works for signed types)

The general pattern here is that any `Module.xyzValue` helper may also have a
corresponding `Module.xyzRef` helper, which just wraps the call in
`Air.internedToRef`.

```

## Parents

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

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