aboutsummaryrefslogtreecommitdiff
path: root/src/value.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-09-09 15:34:43 +0300
committerVeikka Tuominen <git@vexu.eu>2022-09-15 00:48:47 +0300
commit6f6b14621d5a0935d39295d21b5ffad2197f0e2f (patch)
tree317d12067bc2cb1e2952fcc6f1509ed5edbccb30 /src/value.zig
parent930f904aaa7d591d86a8c3216526711be95fcc17 (diff)
downloadzig-6f6b14621d5a0935d39295d21b5ffad2197f0e2f.tar.gz
zig-6f6b14621d5a0935d39295d21b5ffad2197f0e2f.zip
value: hash extern functions
Closes #12766
Diffstat (limited to 'src/value.zig')
-rw-r--r--src/value.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/value.zig b/src/value.zig
index 50f86c7e79..0580d7cd3c 100644
--- a/src/value.zig
+++ b/src/value.zig
@@ -2391,12 +2391,15 @@ pub const Value = extern union {
union_obj.val.hash(active_field_ty, hasher, mod);
},
.Fn => {
- const func: *Module.Fn = val.castTag(.function).?.data;
- // Note that his hashes the *Fn rather than the *Decl. This is
+ // Note that his hashes the *Fn/*ExternFn rather than the *Decl. This is
// to differentiate function bodies from function pointers.
// This is currently redundant since we already hash the zig type tag
// at the top of this function.
- std.hash.autoHash(hasher, func);
+ if (val.castTag(.function)) |func| {
+ std.hash.autoHash(hasher, func.data);
+ } else if (val.castTag(.extern_fn)) |func| {
+ std.hash.autoHash(hasher, func.data);
+ } else unreachable;
},
.Frame => {
@panic("TODO implement hashing frame values");