mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
method call scope
This commit is contained in:
parent
fdd282ee0c
commit
58480b9190
4 changed files with 44 additions and 11 deletions
|
@ -200,12 +200,10 @@ impl<'a> AstNode<'a> for CallExpr<'a> {
|
|||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> ast::ArgListOwner<'a> for CallExpr<'a> {}
|
||||
impl<'a> CallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
pub fn arg_list(self) -> Option<ArgList<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// CastExpr
|
||||
|
@ -934,7 +932,11 @@ impl<'a> AstNode<'a> for MethodCallExpr<'a> {
|
|||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> MethodCallExpr<'a> {}
|
||||
impl<'a> ast::ArgListOwner<'a> for MethodCallExpr<'a> {}
|
||||
impl<'a> MethodCallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// Module
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
|
@ -26,6 +26,12 @@ pub trait LoopBodyOwner<'a>: AstNode<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait ArgListOwner<'a>: AstNode<'a> {
|
||||
fn arg_list(self) -> Option<ArgList<'a>> {
|
||||
child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait TypeParamsOwner<'a>: AstNode<'a> {
|
||||
fn type_param_list(self) -> Option<TypeParamList<'a>> {
|
||||
child_opt(self)
|
||||
|
|
|
@ -388,10 +388,14 @@ Grammar(
|
|||
"NamedFieldList": (),
|
||||
"NamedField": (),
|
||||
"CallExpr": (
|
||||
options: [ "Expr", "ArgList" ]
|
||||
traits: ["ArgListOwner"],
|
||||
options: [ "Expr" ],
|
||||
),
|
||||
"MethodCallExpr": (
|
||||
traits: ["ArgListOwner"],
|
||||
options: [ "Expr" ],
|
||||
),
|
||||
"IndexExpr": (),
|
||||
"MethodCallExpr": (),
|
||||
"FieldExpr": (),
|
||||
"TryExpr": (),
|
||||
"CastExpr": (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue