From 7a5bc94774a50837f8c9bf8b96c8272882aca640 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Aug 2018 16:30:42 +0300 Subject: complete self --- crates/libsyntax2/src/ast/generated.rs | 21 +++++++++++++++++++++ crates/libsyntax2/src/grammar.ron | 2 ++ 2 files changed, 23 insertions(+) (limited to 'crates/libsyntax2/src') 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> { pub fn params(self) -> impl Iterator> + 'a { super::children(self) } +pub fn self_param(self) -> Option> { + 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 { + 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> { 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( ] ), "ParamList": ( + options: [ "SelfParam" ], collections: [ ["params", "Param"] ] ), + "SelfParam": (), "Param": ( options: [ "Pat" ], ), -- cgit v1.2.3