diff options
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 21 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar.ron | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index 58dcf574e..50dc41b27 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -1168,6 +1168,9 @@ impl<'a> ParamList<'a> { | |||
1168 | pub fn params(self) -> impl Iterator<Item = Param<'a>> + 'a { | 1168 | pub fn params(self) -> impl Iterator<Item = Param<'a>> + 'a { |
1169 | super::children(self) | 1169 | super::children(self) |
1170 | } | 1170 | } |
1171 | pub fn self_param(self) -> Option<SelfParam<'a>> { | ||
1172 | super::child_opt(self) | ||
1173 | } | ||
1171 | } | 1174 | } |
1172 | 1175 | ||
1173 | // ParenExpr | 1176 | // ParenExpr |
@@ -1579,6 +1582,24 @@ impl<'a> Root<'a> { | |||
1579 | } | 1582 | } |
1580 | } | 1583 | } |
1581 | 1584 | ||
1585 | // SelfParam | ||
1586 | #[derive(Debug, Clone, Copy)] | ||
1587 | pub struct SelfParam<'a> { | ||
1588 | syntax: SyntaxNodeRef<'a>, | ||
1589 | } | ||
1590 | |||
1591 | impl<'a> AstNode<'a> for SelfParam<'a> { | ||
1592 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1593 | match syntax.kind() { | ||
1594 | SELF_PARAM => Some(SelfParam { syntax }), | ||
1595 | _ => None, | ||
1596 | } | ||
1597 | } | ||
1598 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1599 | } | ||
1600 | |||
1601 | impl<'a> SelfParam<'a> {} | ||
1602 | |||
1582 | // SlicePat | 1603 | // SlicePat |
1583 | #[derive(Debug, Clone, Copy)] | 1604 | #[derive(Debug, Clone, Copy)] |
1584 | pub struct SlicePat<'a> { | 1605 | pub struct SlicePat<'a> { |
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index 77730e306..522521229 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron | |||
@@ -488,10 +488,12 @@ Grammar( | |||
488 | ] | 488 | ] |
489 | ), | 489 | ), |
490 | "ParamList": ( | 490 | "ParamList": ( |
491 | options: [ "SelfParam" ], | ||
491 | collections: [ | 492 | collections: [ |
492 | ["params", "Param"] | 493 | ["params", "Param"] |
493 | ] | 494 | ] |
494 | ), | 495 | ), |
496 | "SelfParam": (), | ||
495 | "Param": ( | 497 | "Param": ( |
496 | options: [ "Pat" ], | 498 | options: [ "Pat" ], |
497 | ), | 499 | ), |