use crate::ast::node::expression::Expression; use crate::ast::node::names::Identifier; #[derive(Debug)] pub struct ObjectAccess { receiver: Box, navigations: Box, } impl ObjectAccess { pub fn new(receiver: Box, navigations: Box) -> Self { Self { receiver, navigations, } } pub fn receiver(&self) -> &Expression { &self.receiver } pub fn receiver_mut(&mut self) -> &mut Expression { &mut self.receiver } pub fn navigations(&self) -> &ObjectNavigations { &self.navigations } pub fn navigations_mut(&mut self) -> &mut ObjectNavigations { &mut self.navigations } } #[derive(Debug)] pub struct ObjectNavigations(Vec>); impl ObjectNavigations { pub fn new(navigations: Vec>) -> Self { Self(navigations) } pub fn navigations(&self) -> Vec<&ObjectNavigation> { self.0.iter().map(Box::as_ref).collect() } pub fn navigations_mut(&mut self) -> Vec<&mut ObjectNavigation> { self.0.iter_mut().map(Box::as_mut).collect() } } #[derive(Debug)] pub enum ObjectNavigation { Index(Box), Identifier(Box), }