protospec_build/asg/expression/
array_index.rs

1use super::*;
2
3#[derive(PartialEq, Clone, Debug)]
4pub struct ArrayIndexExpression {
5    pub array: Box<Expression>,
6    pub index: Box<Expression>,
7    pub span: Span,
8}
9
10impl AsgExpression for ArrayIndexExpression {
11    fn get_type(&self) -> Option<Type> {
12        let parent_type = self.array.get_type()?;
13        match parent_type {
14            Type::Array(parent_type) => Some(parent_type.element.type_.borrow().clone()),
15            _ => None,
16        }
17    }
18}