use allocative::Allocative;
use dupe::Dupe;
use starlark_derive::StarlarkPagable;
use starlark_derive::Trace;
use starlark_derive::VisitSpanMut;
use crate as starlark;
use crate::eval::bc::stack_ptr::BcSlot;
use crate::register_starlark_any;
use crate::values::Freeze;
#[derive(
Clone,
Copy,
Dupe,
Debug,
PartialEq,
Eq,
Trace,
Freeze,
VisitSpanMut,
Allocative,
StarlarkPagable
)]
pub(crate) struct LocalSlotId(pub(crate) u32);
impl LocalSlotId {
#[inline]
pub(crate) fn to_bc_slot(self) -> BcSlot {
BcSlot(self.0)
}
#[inline]
pub(crate) fn to_captured_or_not(self) -> LocalSlotIdCapturedOrNot {
LocalSlotIdCapturedOrNot(self.0)
}
}
#[derive(
Clone,
Copy,
Dupe,
Debug,
PartialEq,
Eq,
Trace,
VisitSpanMut,
StarlarkPagable
)]
pub(crate) struct LocalCapturedSlotId(pub(crate) u32);
impl LocalCapturedSlotId {
#[inline]
pub(crate) fn to_bc_slot(self) -> BcSlot {
BcSlot(self.0)
}
}
#[derive(Clone, Copy, Dupe, Debug, PartialEq, Eq, Trace, pagable::Pagable)]
pub(crate) struct LocalSlotIdCapturedOrNot(pub(crate) u32);
register_starlark_any!(LocalSlotId);