implement accessors for IndexExpr

This commit is contained in:
Aleksey Kladov 2019-08-17 17:17:01 +03:00
parent fd4c083e42
commit 8919aa8065

View file

@ -195,6 +195,15 @@ impl ast::BinExpr {
}
}
impl ast::IndexExpr {
pub fn base(&self) -> Option<ast::Expr> {
children(self).nth(0)
}
pub fn index(&self) -> Option<ast::Expr> {
children(self).nth(1)
}
}
pub enum ArrayExprKind {
Repeat { initializer: Option<ast::Expr>, repeat: Option<ast::Expr> },
ElementList(AstChildren<ast::Expr>),