mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-19 07:51:26 +00:00
Make the slice argument of texImage2D and related functions immutable
This also adds immutable slice whitelisting for Uint8Array, ArrayBufferView, and BufferSource, and removes Uint8ArrayMut.
This commit is contained in:
@ -647,12 +647,10 @@ impl<'src> FirstPassRecord<'src> {
|
||||
_ => return idl_type,
|
||||
};
|
||||
|
||||
if self.immutable_f32_whitelist.contains(op) {
|
||||
if self.immutable_slice_whitelist.contains(op) {
|
||||
flag_slices_immutable(&mut idl_type)
|
||||
}
|
||||
|
||||
// TODO: Add other whitelisted slices here, such as F64 or u8..
|
||||
|
||||
idl_type
|
||||
}
|
||||
}
|
||||
@ -737,7 +735,10 @@ pub fn public() -> syn::Visibility {
|
||||
|
||||
fn flag_slices_immutable(ty: &mut IdlType) {
|
||||
match ty {
|
||||
IdlType::Uint8Array { immutable } => *immutable = true,
|
||||
IdlType::Float32Array { immutable } => *immutable = true,
|
||||
IdlType::ArrayBufferView { immutable } => *immutable = true,
|
||||
IdlType::BufferSource { immutable } => *immutable = true,
|
||||
IdlType::Nullable(item) => flag_slices_immutable(item),
|
||||
IdlType::FrozenArray(item) => flag_slices_immutable(item),
|
||||
IdlType::Sequence(item) => flag_slices_immutable(item),
|
||||
|
Reference in New Issue
Block a user