aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-08-17 15:17:01 +0100
committerAleksey Kladov <[email protected]>2019-08-17 15:17:01 +0100
commit8919aa8065c31d55050a6bfe10b574fc71bcec09 (patch)
treead96d02591e3c629ac35b3cb32591fd9da06af1d
parentfd4c083e429d055190fa830bd2216915fe634b98 (diff)
implement accessors for IndexExpr
-rw-r--r--crates/ra_syntax/src/ast/expr_extensions.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs
index d2c19b98d..20e390209 100644
--- a/crates/ra_syntax/src/ast/expr_extensions.rs
+++ b/crates/ra_syntax/src/ast/expr_extensions.rs
@@ -195,6 +195,15 @@ impl ast::BinExpr {
195 } 195 }
196} 196}
197 197
198impl ast::IndexExpr {
199 pub fn base(&self) -> Option<ast::Expr> {
200 children(self).nth(0)
201 }
202 pub fn index(&self) -> Option<ast::Expr> {
203 children(self).nth(1)
204 }
205}
206
198pub enum ArrayExprKind { 207pub enum ArrayExprKind {
199 Repeat { initializer: Option<ast::Expr>, repeat: Option<ast::Expr> }, 208 Repeat { initializer: Option<ast::Expr>, repeat: Option<ast::Expr> },
200 ElementList(AstChildren<ast::Expr>), 209 ElementList(AstChildren<ast::Expr>),