pub struct ParamArena { /* private fields */ }Expand description
Central storage for all function/method parameter data.
Stores parameter names, types, modes, and comptime flags in separate contiguous arrays for optimal cache locality during type checking.
Implementations§
Source§impl ParamArena
impl ParamArena
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new arena with pre-allocated capacity.
Use when the approximate number of total parameters is known.
Sourcepub fn total_params(&self) -> usize
pub fn total_params(&self) -> usize
Returns the total number of parameters stored in the arena.
Sourcepub fn alloc(
&mut self,
names: impl IntoIterator<Item = Spur>,
types: impl IntoIterator<Item = Type>,
modes: impl IntoIterator<Item = RirParamMode>,
comptime: impl IntoIterator<Item = bool>,
) -> ParamRange
pub fn alloc( &mut self, names: impl IntoIterator<Item = Spur>, types: impl IntoIterator<Item = Type>, modes: impl IntoIterator<Item = RirParamMode>, comptime: impl IntoIterator<Item = bool>, ) -> ParamRange
Allocates storage for a function’s parameters.
All iterators must yield the same number of elements.
§Panics
Panics if the iterators yield different numbers of elements.
Sourcepub fn alloc_method(
&mut self,
names: impl IntoIterator<Item = Spur>,
types: impl IntoIterator<Item = Type>,
) -> ParamRange
pub fn alloc_method( &mut self, names: impl IntoIterator<Item = Spur>, types: impl IntoIterator<Item = Type>, ) -> ParamRange
Allocates storage for a method’s parameters (without comptime flags).
Methods don’t have comptime parameters, so this is a convenience method
that fills the comptime array with false values.
Sourcepub fn names(&self, range: ParamRange) -> &[Spur]
pub fn names(&self, range: ParamRange) -> &[Spur]
Returns the parameter names for a range.
Sourcepub fn types(&self, range: ParamRange) -> &[Type]
pub fn types(&self, range: ParamRange) -> &[Type]
Returns the parameter types for a range.
Sourcepub fn modes(&self, range: ParamRange) -> &[RirParamMode]
pub fn modes(&self, range: ParamRange) -> &[RirParamMode]
Returns the parameter modes for a range.
Sourcepub fn comptime(&self, range: ParamRange) -> &[bool]
pub fn comptime(&self, range: ParamRange) -> &[bool]
Returns the comptime flags for a range.
Sourcepub fn iter(
&self,
range: ParamRange,
) -> impl Iterator<Item = (&Spur, &Type, &RirParamMode, &bool)>
pub fn iter( &self, range: ParamRange, ) -> impl Iterator<Item = (&Spur, &Type, &RirParamMode, &bool)>
Returns an iterator over all parameter data for a range.
Useful for cases where you need to iterate all fields together.
Sourcepub fn name_type_pairs(
&self,
range: ParamRange,
) -> impl Iterator<Item = (&Spur, &Type)>
pub fn name_type_pairs( &self, range: ParamRange, ) -> impl Iterator<Item = (&Spur, &Type)>
Returns an iterator over (name, type) pairs for a range.
Useful for method parameter type checking.
Sourcepub fn type_mode_pairs(
&self,
range: ParamRange,
) -> impl Iterator<Item = (&Type, &RirParamMode)>
pub fn type_mode_pairs( &self, range: ParamRange, ) -> impl Iterator<Item = (&Type, &RirParamMode)>
Returns an iterator over (type, mode) pairs for a range.
Useful for function call argument checking.