aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-10-24 04:36:35 +0100
committermlugg <mlugg@mlugg.co.uk>2023-10-24 14:28:33 +0100
commit20bb81166f36668413703e0d74b3e283c55ab8ca (patch)
treed68649f59e0899fbc49e7f9a188d3738f0ca1a3f /src/value.zig
parentbb0419599aa93455f3ae0969f4bfd80204807596 (diff)
downloadzig-20bb81166f36668413703e0d74b3e283c55ab8ca.tar.gz
zig-20bb81166f36668413703e0d74b3e283c55ab8ca.zip
InternPool: remove runtime_value representation
The main goal of this commit is to remove the `runtime_value` field from `InternPool.Key` (and its associated representation), but there are a few dominos. Specifically, this mostly eliminates the "maybe runtime" concept from value resolution in Sema: so some resolution functions like `resolveMaybeUndefValAllowVariablesMaybeRuntime` are gone. This required a small change to struct/union/array initializers, to no longer use `runtime_value` if a field was a `variable` - I'm not convinced this case was even reachable, as `variable` should only ever exist as the trivial value of a global runtime `var` decl. Now, the only case in which a `Sema.resolveMaybeUndefVal`-esque function can return the `variable` key is `resolveMaybeUndefValAllowVariables`, which is directly called from `Sema.resolveInstValueAllowVariables` (previously `Sema.resolveInstValue`), which is only used for resolving the value of a Decl from `Module.semaDecl`. While changing these functions, I also slightly reordered and restructured some of them, and updated their doc comments.
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/value.zig b/src/value.zig
index 053cf7a768..08d692beab 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -364,7 +364,6 @@ pub const Value = struct {
.inferred_error_set_type,
.undef,
- .runtime_value,
.simple_value,
.variable,
.extern_func,
@@ -464,7 +463,6 @@ pub const Value = struct {
.bool_true => BigIntMutable.init(&space.limbs, 1).toConst(),
.null_value => BigIntMutable.init(&space.limbs, 0).toConst(),
else => switch (mod.intern_pool.indexToKey(val.toIntern())) {
- .runtime_value => |runtime_value| runtime_value.val.toValue().toBigIntAdvanced(space, mod, opt_sema),
.int => |int| switch (int.storage) {
.u64, .i64, .big_int => int.storage.toBigInt(space),
.lazy_align, .lazy_size => |ty| {
@@ -1657,10 +1655,6 @@ pub const Value = struct {
};
}
- pub fn isRuntimeValue(val: Value, mod: *Module) bool {
- return mod.intern_pool.isRuntimeValue(val.toIntern());
- }
-
/// Returns true if a Value is backed by a variable
pub fn isVariable(val: Value, mod: *Module) bool {
return val.ip_index != .none and switch (mod.intern_pool.indexToKey(val.toIntern())) {