diff options
author | Aleksey Kladov <[email protected]> | 2019-08-17 15:17:01 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-08-17 15:17:01 +0100 |
commit | 8919aa8065c31d55050a6bfe10b574fc71bcec09 (patch) | |
tree | ad96d02591e3c629ac35b3cb32591fd9da06af1d /crates/ra_syntax | |
parent | fd4c083e429d055190fa830bd2216915fe634b98 (diff) |
implement accessors for IndexExpr
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 9 |
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 | ||
198 | impl 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 | |||
198 | pub enum ArrayExprKind { | 207 | pub 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>), |