complete self
This commit is contained in:
@@ -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> {
|
||||
|
||||
@@ -488,10 +488,12 @@ Grammar(
|
||||
]
|
||||
),
|
||||
"ParamList": (
|
||||
options: [ "SelfParam" ],
|
||||
collections: [
|
||||
["params", "Param"]
|
||||
]
|
||||
),
|
||||
"SelfParam": (),
|
||||
"Param": (
|
||||
options: [ "Pat" ],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user