aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs
diff options
context:
space:
mode:
authorMarcus Klaas de Vries <[email protected]>2019-01-18 13:52:31 +0000
committerAleksey Kladov <[email protected]>2019-01-19 12:37:26 +0000
commitf9a6050034b2ab4358d8a46dd8432de41cebdf0c (patch)
tree9de2701b95000fc0a089213bebf8b88924ff61c4 /crates/ra_syntax/src/ast/generated.rs
parentd2769837f1f9c94b977bd6022090f8e5cd02410c (diff)
Move parsing of field pattern lists to the parser (where it belongs)
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs35
1 files changed, 34 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index ead0f1293..23a573d74 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -858,6 +858,35 @@ impl FieldExpr {
858 } 858 }
859} 859}
860 860
861// FieldPat
862#[derive(Debug, PartialEq, Eq, Hash)]
863#[repr(transparent)]
864pub struct FieldPat {
865 pub(crate) syntax: SyntaxNode,
866}
867unsafe impl TransparentNewType for FieldPat {
868 type Repr = rowan::SyntaxNode<RaTypes>;
869}
870
871impl AstNode for FieldPat {
872 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
873 match syntax.kind() {
874 FIELD_PAT => Some(FieldPat::from_repr(syntax.into_repr())),
875 _ => None,
876 }
877 }
878 fn syntax(&self) -> &SyntaxNode { &self.syntax }
879 fn to_owned(&self) -> TreeArc<FieldPat> { TreeArc::cast(self.syntax.to_owned()) }
880}
881
882
883impl ast::NameOwner for FieldPat {}
884impl FieldPat {
885 pub fn pat(&self) -> Option<&Pat> {
886 super::child_opt(self)
887 }
888}
889
861// FieldPatList 890// FieldPatList
862#[derive(Debug, PartialEq, Eq, Hash)] 891#[derive(Debug, PartialEq, Eq, Hash)]
863#[repr(transparent)] 892#[repr(transparent)]
@@ -880,7 +909,11 @@ impl AstNode for FieldPatList {
880} 909}
881 910
882 911
883impl FieldPatList {} 912impl FieldPatList {
913 pub fn pats(&self) -> impl Iterator<Item = &FieldPat> {
914 super::children(self)
915 }
916}
884 917
885// FloatNumber 918// FloatNumber
886#[derive(Debug, PartialEq, Eq, Hash)] 919#[derive(Debug, PartialEq, Eq, Hash)]