protospec_build/asg/expression/
enum_access.rs

1use super::*;
2
3#[derive(PartialEq, Clone, Debug)]
4pub struct EnumAccessExpression {
5    pub enum_field: Arc<Field>,
6    pub variant: Arc<Const>,
7    pub span: Span,
8}
9
10impl AsgExpression for EnumAccessExpression {
11    fn get_type(&self) -> Option<Type> {
12        match &*self.enum_field.type_.borrow() {
13            Type::Enum(e) => Some(Type::Scalar(e.rep)),
14            Type::Bitfield(e) => Some(Type::Scalar(e.rep)),
15            _ => None,
16        }
17    }
18}