mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
scopes
This commit is contained in:
parent
9b69c7df19
commit
8b0298ce09
7 changed files with 155 additions and 75 deletions
|
@ -383,6 +383,24 @@ impl<'a> AstNode<'a> for Expr<'a> {
|
|||
|
||||
impl<'a> Expr<'a> {}
|
||||
|
||||
// ExprStmt
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ExprStmt<'a> {
|
||||
syntax: SyntaxNodeRef<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AstNode<'a> for ExprStmt<'a> {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
EXPR_STMT => Some(ExprStmt { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> ExprStmt<'a> {}
|
||||
|
||||
// FieldExpr
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct FieldExpr<'a> {
|
||||
|
@ -442,6 +460,10 @@ impl<'a> FnDef<'a> {
|
|||
pub fn param_list(self) -> Option<ParamList<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
|
||||
pub fn body(self) -> Option<Block<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// FnPointerType
|
||||
|
@ -626,6 +648,10 @@ impl<'a> LetStmt<'a> {
|
|||
pub fn pat(self) -> Option<Pat<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
|
||||
pub fn initializer(self) -> Option<Expr<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// LoopExpr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue