From 8919aa8065c31d55050a6bfe10b574fc71bcec09 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 17 Aug 2019 17:17:01 +0300 Subject: implement accessors for IndexExpr --- crates/ra_syntax/src/ast/expr_extensions.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_syntax/src') 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 { } } +impl ast::IndexExpr { + pub fn base(&self) -> Option { + children(self).nth(0) + } + pub fn index(&self) -> Option { + children(self).nth(1) + } +} + pub enum ArrayExprKind { Repeat { initializer: Option, repeat: Option }, ElementList(AstChildren), -- cgit v1.2.3