protospec-build 0.3.0

One binary format language to rule them all, One binary format language to find them, One binary format language to bring them all and in the darkness bind them.
Documentation
use super::*;


impl Scope {
    pub fn convert_length(
        self_: &Arc<RefCell<Scope>>,
        typ: &ast::LengthConstraint,
    ) -> AsgResult<LengthConstraint> {
        Ok(LengthConstraint {
            expandable: typ.expandable,
            value: if let Some(inner) = &typ.inner {
                Some(Scope::convert_expr(
                    self_,
                    inner,
                    if typ.expandable {
                        PartialType::Array(Some(Box::new(PartialType::Scalar(PartialScalarType::Some(
                            ScalarType::U8,
                        )))))
                    } else {
                        Type::Scalar(ScalarType::U64).into()
                    },
                )?)
            } else {
                None
            },
        })
    }
}