zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 076b54c8e7e8472556558543c6fb3eaa8967de78 (tree)
parent 1ae839cd248c9eee8a9ff0643d7b80628f5f5533
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sat, 22 Jul 2023 19:57:23 -0700

frontend: fix wrong result of Value.getFunction

Fixes regression introduced in
db33ee45b7261c9ec62a1087cfc9377bc4e7aa8f.

Found from compiling bun. Unfortunately we do not have a behavior test
reduction for this bug.

Diffstat:
Msrc/value.zig | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/value.zig b/src/value.zig @@ -483,10 +483,10 @@ pub const Value = struct { } pub fn getFunction(val: Value, mod: *Module) ?InternPool.Key.Func { - return switch (mod.intern_pool.indexToKey(val.toIntern())) { + return if (val.ip_index != .none) switch (mod.intern_pool.indexToKey(val.toIntern())) { .func => |x| x, else => null, - }; + } else null; } pub fn getExternFunc(val: Value, mod: *Module) ?InternPool.Key.ExternFunc {