compose_syntax/ast/
index_access.rs

1use crate::ast::Expr;
2use crate::ast::macros::node;
3
4
5node! {
6    /// A `target[index]` index access.
7    struct IndexAccess
8}
9
10impl<'a> IndexAccess<'a> {
11
12    /// The target of the index expression
13    pub fn target(self) -> Expr<'a> {
14        self.0.cast_first()
15    }
16
17    /// The index of the index expression
18    pub fn index(self) -> Expr<'a> {
19        self.0.cast_last()
20    }
21}