pub fn constant_value<C>(&self, ctx: C) -> Result<(Dir, &'t Const2<'t>, &'t Const2<'t>)>
    where
        C: ExprContext<'t> + Copy,
    {
        let ty = self.bound_type(ctx)?;
        match *self {
            Range2::Immediate(_, d, l, r) => {
                let lc = l.constant_value(&ctx).and_then(|x| x.cast(ty).emit(ctx));
                let rc = r.constant_value(&ctx).and_then(|x| x.cast(ty).emit(ctx));
                Ok((d.value, ctx.maybe_alloc(lc?), ctx.maybe_alloc(rc?)))
            }
        }
    }
/// Determine the constant value of the range.
Determine the constant value of the range.
Determine the constant value of the range .
pub fn constant_value<C>(&self, ctx: C) -> Result<(Dir, &'t Const2<'t>, &'t Const2<'t>)>
    where
        C: ExprContext<'t> + Copy,
    {
        let ty = self.bound_type(ctx)?;
        match *self {
            Range2::Immediate(_, d, l, r) => {
                let lc = l.constant_value(&ctx).and_then(|x| x.cast(ty).emit(ctx));
                let rc = r.constant_value(&ctx).and_then(|x| x.cast(ty).emit(ctx));
                Ok((d.value, ctx.maybe_alloc(lc?), ctx.maybe_alloc(rc?)))
            }
        }
    }
pub fn constant_value < C > ( & self , ctx : C ) -> Result < ( Dir , & ' t Const2 < ' t > , & ' t Const2 < ' t > ) > where C : ExprContext < ' t > + Copy , { let ty = self . bound_type ( ctx ) ? ; match * self { Range2 :: Immediate ( _ , d , l , r ) => { let lc = l . constant_value ( & ctx ) . and_then ( | x | x . cast ( ty ) . emit ( ctx ) ) ; let rc = r . constant_value ( & ctx ) . and_then ( | x | x . cast ( ty ) . emit ( ctx ) ) ; Ok ( ( d . value , ctx . maybe_alloc ( lc ? ) , ctx . maybe_alloc ( rc ? ) ) ) } } }
Determine the constant value of the range.
Determine the constant value of the range .
&self
ctx
C
&self
ctx
C