pub fn lower_range(
elem_ty: &ResolvedType,
left: &IrExpr,
right: &IrExpr,
sink: &mut InstructionSink<'_>,
ctx: &LowerContext<'_>,
) -> Result<(), LowerError>Expand description
Lower a BinaryOp { op: Range, left, right } expression.
Allocates a Range<T> value as a two-field aggregate
{ start: T, end: T } in linear memory:
- Plan the range layout via
plan_rangefrom the expression’s declared element type. - Allocate
layout.sizebytes through the bump allocator and park the base pointer in a fresh scratch local. - Lower
left, store atstart_offset = 0. Lowerright, store atlayout.end_offset. Both stores use the primitive width appropriate to the bound type. - Leave the base pointer on the stack as the range value.
The element type must be a primitive (validated upstream by
plan_range); aggregate-bound ranges surface as
LayoutError::NotYetSupported.