mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
fix hir for new block syntax
This commit is contained in:
parent
dcf8e89503
commit
5e3f291195
14 changed files with 72 additions and 57 deletions
|
@ -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<ast::Block> {
|
||||
pub fn then_branch(&self) -> Option<ast::BlockExpr> {
|
||||
self.blocks().nth(0)
|
||||
}
|
||||
pub fn else_branch(&self) -> Option<ElseBranch> {
|
||||
|
@ -28,7 +28,7 @@ impl ast::IfExpr {
|
|||
Some(res)
|
||||
}
|
||||
|
||||
fn blocks(&self) -> AstChildren<ast::Block> {
|
||||
fn blocks(&self) -> AstChildren<ast::BlockExpr> {
|
||||
children(self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3135,7 +3135,7 @@ impl AstNode for TryBlockExpr {
|
|||
}
|
||||
}
|
||||
impl TryBlockExpr {
|
||||
pub fn block(&self) -> Option<Block> {
|
||||
pub fn body(&self) -> Option<BlockExpr> {
|
||||
AstChildren::new(&self.syntax).next()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ pub trait VisibilityOwner: AstNode {
|
|||
}
|
||||
|
||||
pub trait LoopBodyOwner: AstNode {
|
||||
fn loop_body(&self) -> Option<ast::Block> {
|
||||
fn loop_body(&self) -> Option<ast::BlockExpr> {
|
||||
child_opt(self)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue