aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-31 14:30:42 +0100
committerAleksey Kladov <[email protected]>2018-08-31 14:30:42 +0100
commit7a5bc94774a50837f8c9bf8b96c8272882aca640 (patch)
tree7d96566cbbf7bdd636fd095acb6bff12bba1ec13 /crates/libsyntax2/src
parentcdb9b4cbf417976739de5147938e2c3080e497b9 (diff)
complete self
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs21
-rw-r--r--crates/libsyntax2/src/grammar.ron2
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 }
1171pub 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)]
1587pub struct SelfParam<'a> {
1588 syntax: SyntaxNodeRef<'a>,
1589}
1590
1591impl<'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
1601impl<'a> SelfParam<'a> {}
1602
1582// SlicePat 1603// SlicePat
1583#[derive(Debug, Clone, Copy)] 1604#[derive(Debug, Clone, Copy)]
1584pub struct SlicePat<'a> { 1605pub 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 ),