diff --git a/crates/compiler-core/src/bytecode.rs b/crates/compiler-core/src/bytecode.rs index ba1639170a7..0272270526b 100644 --- a/crates/compiler-core/src/bytecode.rs +++ b/crates/compiler-core/src/bytecode.rs @@ -11,7 +11,7 @@ use bitflags::bitflags; use core::{ cell::UnsafeCell, hash, mem, - ops::{Deref, Index, IndexMut}, + ops::{Deref, DerefMut, Index, IndexMut}, sync::atomic::{AtomicU8, AtomicU16, AtomicUsize, Ordering}, }; use itertools::Itertools; @@ -383,6 +383,12 @@ impl Deref for Constants { } } +impl DerefMut for Constants { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + impl Index for Constants { type Output = C; @@ -391,6 +397,12 @@ impl Index for Constants { } } +impl IndexMut for Constants { + fn index_mut(&mut self, consti: oparg::ConstIdx) -> &mut Self::Output { + &mut self.0[consti.as_usize()] + } +} + impl FromIterator for Constants { fn from_iter>(iter: T) -> Self { Self(iter.into_iter().collect())