aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-06 17:45:05 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-06 17:45:05 -0800
commitb1fcc9e6bf77e98a7798fc8a4b40c3f2e814f701 (patch)
treeea7e2664e347b717c1ef42c646f0b5650c5606a5 /src
parent1f174b9d9580ed1101c043963b17e2bd27aedf81 (diff)
downloadbun-b1fcc9e6bf77e98a7798fc8a4b40c3f2e814f701.tar.gz
bun-b1fcc9e6bf77e98a7798fc8a4b40c3f2e814f701.tar.zst
bun-b1fcc9e6bf77e98a7798fc8a4b40c3f2e814f701.zip
Fix bug when passing ABI Types as integers
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/api/ffi.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bun.js/api/ffi.zig b/src/bun.js/api/ffi.zig
index 0fe736258..dd5de1da7 100644
--- a/src/bun.js/api/ffi.zig
+++ b/src/bun.js/api/ffi.zig
@@ -522,9 +522,9 @@ pub const FFI = struct {
}
if (val.isAnyInt()) {
- const int = val.toInt32();
+ const int = val.to(i32);
switch (int) {
- 0...14 => {
+ 0...ABIType.max => {
abi_types.appendAssumeCapacity(@intToEnum(ABIType, int));
continue;
},
@@ -561,7 +561,7 @@ pub const FFI = struct {
if (ret_value.isAnyInt()) {
const int = ret_value.toInt32();
switch (int) {
- 0...14 => {
+ 0...ABIType.max => {
return_type = @intToEnum(ABIType, int);
break :brk;
},
@@ -1330,6 +1330,8 @@ pub const FFI = struct {
function = 17,
+ pub const max = @enumToInt(ABIType.function);
+
/// Types that we can directly pass through as an `int64_t`
pub fn needsACastInC(this: ABIType) bool {
return switch (this) {