mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
complete self
This commit is contained in:
parent
cdb9b4cbf4
commit
7a5bc94774
4 changed files with 40 additions and 0 deletions
|
@ -1168,6 +1168,9 @@ impl<'a> ParamList<'a> {
|
|||
pub fn params(self) -> impl Iterator<Item = Param<'a>> + 'a {
|
||||
super::children(self)
|
||||
}
|
||||
pub fn self_param(self) -> Option<SelfParam<'a>> {
|
||||
super::child_opt(self)
|
||||
}
|
||||
}
|
||||
|
||||
// ParenExpr
|
||||
|
@ -1579,6 +1582,24 @@ impl<'a> Root<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
// SelfParam
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SelfParam<'a> {
|
||||
syntax: SyntaxNodeRef<'a>,
|
||||
}
|
||||
|
||||
impl<'a> AstNode<'a> for SelfParam<'a> {
|
||||
fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
|
||||
match syntax.kind() {
|
||||
SELF_PARAM => Some(SelfParam { syntax }),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
|
||||
}
|
||||
|
||||
impl<'a> SelfParam<'a> {}
|
||||
|
||||
// SlicePat
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct SlicePat<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue