From 5e3f291195b580580be7ce5622f54ebca75fb9f0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 2 Sep 2019 21:23:19 +0300 Subject: fix hir for new block syntax --- crates/ra_syntax/src/ast/expr_extensions.rs | 6 +++--- crates/ra_syntax/src/ast/generated.rs | 2 +- crates/ra_syntax/src/ast/traits.rs | 2 +- crates/ra_syntax/src/grammar.ron | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (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 d7ea4354d..1324965cf 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs @@ -9,12 +9,12 @@ use crate::{ #[derive(Debug, Clone, PartialEq, Eq)] pub enum ElseBranch { - Block(ast::Block), + Block(ast::BlockExpr), IfExpr(ast::IfExpr), } impl ast::IfExpr { - pub fn then_branch(&self) -> Option { + pub fn then_branch(&self) -> Option { self.blocks().nth(0) } pub fn else_branch(&self) -> Option { @@ -28,7 +28,7 @@ impl ast::IfExpr { Some(res) } - fn blocks(&self) -> AstChildren { + fn blocks(&self) -> AstChildren { children(self) } } diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index fd85a3231..e2a92ae60 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -3135,7 +3135,7 @@ impl AstNode for TryBlockExpr { } } impl TryBlockExpr { - pub fn block(&self) -> Option { + pub fn body(&self) -> Option { AstChildren::new(&self.syntax).next() } } diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 20c251fba..c3e676d4c 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs @@ -28,7 +28,7 @@ pub trait VisibilityOwner: AstNode { } pub trait LoopBodyOwner: AstNode { - fn loop_body(&self) -> Option { + fn loop_body(&self) -> Option { child_opt(self) } } diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 37166182f..c14ee0e85 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -426,7 +426,7 @@ Grammar( traits: ["LoopBodyOwner"], ), "TryBlockExpr": ( - options: ["Block"], + options: [["body", "BlockExpr"]], ), "ForExpr": ( traits: ["LoopBodyOwner"], -- cgit v1.2.3