diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-09 15:34:43 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-09-15 00:48:47 +0300 |
| commit | 6f6b14621d5a0935d39295d21b5ffad2197f0e2f (patch) | |
| tree | 317d12067bc2cb1e2952fcc6f1509ed5edbccb30 /src/value.zig | |
| parent | 930f904aaa7d591d86a8c3216526711be95fcc17 (diff) | |
| download | zig-6f6b14621d5a0935d39295d21b5ffad2197f0e2f.tar.gz zig-6f6b14621d5a0935d39295d21b5ffad2197f0e2f.zip | |
value: hash extern functions
Closes #12766
Diffstat (limited to 'src/value.zig')
| -rw-r--r-- | src/value.zig | 9 |
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"); |
