mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-07-31 03:51:56 +00:00
Expand LongLong to (i32 or f64)
instead of i64
This commit tweaks WebIDL expansion of the "long long" and "unsigned long long" types to expand to a union of an 32-bit integer and a double. This reflects how almost none of the APIs on the web today actually work with a `BigInt` (what the previous Rust type of `i64` translates to) and how JS itself fundamentally operates with these APIs. Eventually this may not be necessary if we can natively connect to C++ engines with the `i64` type, but until that day comes this should provide more useful interfaces as they shoudl work in all browsers. Closes #800
This commit is contained in:
@@ -449,8 +449,8 @@ impl<'a> IdlType<'a> {
|
||||
IdlType::UnsignedShort => Some(ident_ty(raw_ident("u16"))),
|
||||
IdlType::Long => Some(ident_ty(raw_ident("i32"))),
|
||||
IdlType::UnsignedLong => Some(ident_ty(raw_ident("u32"))),
|
||||
IdlType::LongLong => Some(ident_ty(raw_ident("i64"))),
|
||||
IdlType::UnsignedLongLong => Some(ident_ty(raw_ident("u64"))),
|
||||
IdlType::LongLong => None,
|
||||
IdlType::UnsignedLongLong => None,
|
||||
IdlType::Float => Some(ident_ty(raw_ident("f32"))),
|
||||
IdlType::UnrestrictedFloat => Some(ident_ty(raw_ident("f32"))),
|
||||
IdlType::Double => Some(ident_ty(raw_ident("f64"))),
|
||||
@@ -582,6 +582,12 @@ impl<'a> IdlType<'a> {
|
||||
IdlType::BufferSource => {
|
||||
vec![IdlType::BufferSource, IdlType::Uint8ArrayMut]
|
||||
}
|
||||
IdlType::LongLong => {
|
||||
vec![IdlType::Long, IdlType::Double]
|
||||
}
|
||||
IdlType::UnsignedLongLong => {
|
||||
vec![IdlType::UnsignedLong, IdlType::Double]
|
||||
}
|
||||
idl_type @ _ => vec![idl_type.clone()],
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user