pub fn term_to_range(&self, term: Spanned<Term>) -> Result<Spanned<hir::Range>> {
        Ok(Spanned::new(
            match term.value {
                // Term::Attr(..) => ...
                Term::Range(dir, lb, rb) => hir::Range::Immediate(
                    dir.value,
                    self.term_to_expr(*lb)?,
                    self.term_to_expr(*rb)?,
                ),
                _ => {
                    self.emit(
                        DiagBuilder2::error(format!(
                            "`{}` is not a valid range",
                            term.span.extract()
                        ))
                        .span(term.span)
                        .add_note("A range can be one of the following:")
                        .add_note("- an ascending range of the form `a to b`")
                        .add_note("- a descending range of the form `a downto b`")
                        .add_note("- a range attribute of the form `T'range`")
                        .add_note("See IEEE 1076-2008 section 5.2.1."),
                    );
                    debugln!("It is a {:#?}", term);
                    return Err(());
                }
            },
            term.span,
        ))
    }
/// Map a term to a range.
Map a term to a range.
Map a term to a range .
pub fn term_to_range(&self, term: Spanned<Term>) -> Result<Spanned<hir::Range>> {
        Ok(Spanned::new(
            match term.value {
                // Term::Attr(..) => ...
                Term::Range(dir, lb, rb) => hir::Range::Immediate(
                    dir.value,
                    self.term_to_expr(*lb)?,
                    self.term_to_expr(*rb)?,
                ),
                _ => {
                    self.emit(
                        DiagBuilder2::error(format!(
                            "`{}` is not a valid range",
                            term.span.extract()
                        ))
                        .span(term.span)
                        .add_note("A range can be one of the following:")
                        .add_note("- an ascending range of the form `a to b`")
                        .add_note("- a descending range of the form `a downto b`")
                        .add_note("- a range attribute of the form `T'range`")
                        .add_note("See IEEE 1076-2008 section 5.2.1."),
                    );
                    debugln!("It is a {:#?}", term);
                    return Err(());
                }
            },
            term.span,
        ))
    }
pub fn term_to_range ( & self , term : Spanned < Term > ) -> Result < Spanned < hir :: Range > > { Ok ( Spanned :: new ( match term . value { // Term::Attr(..) => ... Term :: Range ( dir , lb , rb ) => hir :: Range :: Immediate ( dir . value , self . term_to_expr ( * lb ) ? , self . term_to_expr ( * rb ) ? , ) , _ => { self . emit ( DiagBuilder2 :: error ( format ! ( " " term span extract ( ) ) ) . span ( term . span ) . add_note ( " " ) . add_note ( " " ) . add_note ( " " ) . add_note ( " " ) . add_note ( " " ) , ) ; debugln ! ( " " term ) ; return Err ( ( ) ) ; } } , term . span , ) ) }
Map a term to a range.
Map a term to a range .
&self
term
Spanned<Term>
&self
term
Spanned<Term>